pub struct LineBuffer<B: Buffer> { /* private fields */ }
Expand description
High level interface to line buffer
Implementations§
Source§impl LineBuffer<UnboundedBuffer>
impl LineBuffer<UnboundedBuffer>
Sourcepub fn new_unbounded() -> Self
pub fn new_unbounded() -> Self
Create new static line buffer
Source§impl<'a> LineBuffer<SliceBuffer<'a>>
impl<'a> LineBuffer<SliceBuffer<'a>>
Sourcepub fn from_slice(buffer: &'a mut [u8]) -> Self
pub fn from_slice(buffer: &'a mut [u8]) -> Self
Create new static line buffer
Source§impl<B: Buffer> LineBuffer<B>
impl<B: Buffer> LineBuffer<B>
Sourcepub fn as_str(&self) -> &str
pub fn as_str(&self) -> &str
Return buffer as string. The buffer should only hold a valid UTF-8, so this function is infallible.
Sourcepub fn delete_after_char(&mut self, char_index: usize)
pub fn delete_after_char(&mut self, char_index: usize)
Delete buffer after character index
Sourcepub fn delete_previous_word(&mut self, char_index: usize) -> usize
pub fn delete_previous_word(&mut self, char_index: usize) -> usize
Delete previous word from character index
Sourcepub fn swap_chars(&mut self, char_index: usize)
pub fn swap_chars(&mut self, char_index: usize)
Swap characters at index
Sourcepub unsafe fn insert_bytes(
&mut self,
index: usize,
bytes: &[u8],
) -> Result<(), ()>
pub unsafe fn insert_bytes( &mut self, index: usize, bytes: &[u8], ) -> Result<(), ()>
Insert bytes at index
§Safety
The caller must ensure that the input bytes are a valid UTF-8 sequence and that the byte index aligns with a valid UTF-8 character index.
Sourcepub fn insert_utf8_char(
&mut self,
char_index: usize,
c: Utf8Char,
) -> Result<(), Utf8Char>
pub fn insert_utf8_char( &mut self, char_index: usize, c: Utf8Char, ) -> Result<(), Utf8Char>
Insert UTF-8 char at position
Auto Trait Implementations§
impl<B> Freeze for LineBuffer<B>where
B: Freeze,
impl<B> RefUnwindSafe for LineBuffer<B>where
B: RefUnwindSafe,
impl<B> Send for LineBuffer<B>where
B: Send,
impl<B> Sync for LineBuffer<B>where
B: Sync,
impl<B> Unpin for LineBuffer<B>where
B: Unpin,
impl<B> UnwindSafe for LineBuffer<B>where
B: UnwindSafe,
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