pub struct Buffer { /* private fields */ }
Expand description
A Gap buffer. This represents the text of a buffer, and allows for efficient insertion and deletion of text.
Implementations§
Source§impl Buffer
impl Buffer
pub fn new() -> Self
pub fn with_gap(gap: usize) -> Self
pub fn insert_char(&mut self, chr: char)
pub fn insert(&mut self, slice: &str)
pub fn delete_backwards(&mut self, size: usize)
pub fn delete_forwards(&mut self, size: usize)
pub fn delete_range(&mut self, beg: usize, end: usize)
pub fn cursor(&self) -> Position
pub fn char_at(&self, pos: usize) -> Option<char>
pub fn move_gap_out_of(&mut self, range: impl RangeBounds<usize>)
pub fn set_cursor(&mut self, pos: usize)
pub fn len_bytes(&self) -> usize
pub const fn len_chars(&self) -> usize
pub const fn is_empty(&self) -> bool
pub fn char_to_byte(&self, pos: usize) -> usize
pub fn byte_to_char(&self, pos: usize) -> usize
pub fn as_str(&mut self) -> &str
pub fn slice(&self, bounds: impl RangeBounds<usize>) -> (&str, &str)
Trait Implementations§
Source§impl GetSize for Buffer
impl GetSize for Buffer
Source§fn get_heap_size(&self) -> usize
fn get_heap_size(&self) -> usize
Determines how many bytes this object occupies inside the heap. Read more
Source§fn get_heap_size_with_tracker<TRACKER: GetSizeTracker>(
&self,
tracker: TRACKER,
) -> (usize, TRACKER)
fn get_heap_size_with_tracker<TRACKER: GetSizeTracker>( &self, tracker: TRACKER, ) -> (usize, TRACKER)
Determines how many bytes this object occupies inside the heap while using a
tracker
. Read more§fn get_stack_size() -> usize
fn get_stack_size() -> usize
Determines how may bytes this object occupies inside the stack. Read more
§fn get_size_with_tracker<T>(&self, tracker: T) -> (usize, T)where
T: GetSizeTracker,
fn get_size_with_tracker<T>(&self, tracker: T) -> (usize, T)where
T: GetSizeTracker,
Determines the total size of the object while using a
tracker
. Read moreAuto Trait Implementations§
impl Freeze for Buffer
impl RefUnwindSafe for Buffer
impl Send for Buffer
impl Sync for Buffer
impl Unpin for Buffer
impl UnwindSafe for Buffer
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more