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(&self) -> usize
pub const fn len_chars(&self) -> usize
pub const fn is_empty(&self) -> bool
pub fn as_str(&mut self) -> &str
pub fn read(&self, bounds: impl RangeBounds<usize>) -> Cow<'_, 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_stack_size() -> usize
fn get_stack_size() -> usize
Determines how may bytes this object occupies inside the stack. Read more
Auto 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