pub struct StRingBuffer<const SIZE: usize> { /* private fields */ }Expand description
An implementation of StringBuffer using const generics to store its data on
the stack.
Implementations§
Trait Implementations§
Source§impl<const SIZE: usize> Clone for StRingBuffer<SIZE>
impl<const SIZE: usize> Clone for StRingBuffer<SIZE>
Source§fn clone(&self) -> StRingBuffer<SIZE>
fn clone(&self) -> StRingBuffer<SIZE>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<const SIZE: usize> Debug for StRingBuffer<SIZE>
impl<const SIZE: usize> Debug for StRingBuffer<SIZE>
Source§impl<const SIZE: usize> Display for StRingBuffer<SIZE>
impl<const SIZE: usize> Display for StRingBuffer<SIZE>
Source§impl<const SIZE: usize> Hash for StRingBuffer<SIZE>
impl<const SIZE: usize> Hash for StRingBuffer<SIZE>
Source§impl<const SIZE: usize> IntoIterator for StRingBuffer<SIZE>
impl<const SIZE: usize> IntoIterator for StRingBuffer<SIZE>
Source§impl<const SIZE: usize> Ord for StRingBuffer<SIZE>
impl<const SIZE: usize> Ord for StRingBuffer<SIZE>
Source§fn cmp(&self, other: &StRingBuffer<SIZE>) -> Ordering
fn cmp(&self, other: &StRingBuffer<SIZE>) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl<const SIZE: usize> PartialEq for StRingBuffer<SIZE>
impl<const SIZE: usize> PartialEq for StRingBuffer<SIZE>
Source§impl<const SIZE: usize> PartialOrd for StRingBuffer<SIZE>
impl<const SIZE: usize> PartialOrd for StRingBuffer<SIZE>
Source§impl<const SIZE: usize> StringBuffer for StRingBuffer<SIZE>
impl<const SIZE: usize> StringBuffer for StRingBuffer<SIZE>
Source§fn push_char(&mut self, c: char)
fn push_char(&mut self, c: char)
Adds a char to the buffer. Overwrites the start if the buffer is full. Read more
Source§fn pop(&mut self) -> Option<char>
fn pop(&mut self) -> Option<char>
Remove a char from the buffer if one exists. Returns
None if the buffer is empty.Source§fn pop_front(&mut self) -> Option<char>
fn pop_front(&mut self) -> Option<char>
Remove a char from the front of the buffer if one exists. Returns
None if the buffer is empty.Source§fn try_push_char(&mut self, c: char) -> Result<usize, StringBufferError>
fn try_push_char(&mut self, c: char) -> Result<usize, StringBufferError>
Tries to push the given character into the buffer. Will return Ok(c.bytes_len) if the write
succeeded. If there is not enough room for the char or the buffer is full then
Err(NotEnoughSpaceForChar) or Err(BufferFull) is returned respectively. Read more
Source§fn push_str(&mut self, s: &str)
fn push_str(&mut self, s: &str)
Adds a &str to the buffer. Overwrites the start if the buffer is full. Read more
Source§fn try_push_some(&mut self, s: &str) -> Result<usize, StringBufferError>
fn try_push_some(&mut self, s: &str) -> Result<usize, StringBufferError>
Will push as many chars as will fit into the existing space of the buffer. Will not
overwrite any existing data. Read more
Source§fn as_slices(&self) -> (&str, &str)
fn as_slices(&self) -> (&str, &str)
Get a reference to the two buffer segments in order. Read more
Source§fn align_no_alloc(&mut self)
fn align_no_alloc(&mut self)
Aligns the head of the buffer to the start via rotation. Compared to
align this function does not allocate any memory; however, it works
in O(buffer.len()) time. Read moreSource§fn len(&self) -> usize
fn len(&self) -> usize
Returns the length of this buffer, in bytes, not chars or graphemes Read more
Source§fn capacity(&self) -> usize
fn capacity(&self) -> usize
The number of bytes this buffer can hold. Not the number of chars or graphemes. Read more
Source§fn remaining_size(&self) -> usize
fn remaining_size(&self) -> usize
Convenience function to return the number of bytes remaining in the buffer before data is
overwritten. This is roughly equivalent to
self.capacity() - self.len(), but takes into
account any padding required along the edge of the buffer.Source§fn try_push_all(&mut self, s: &str) -> Result<(), StringBufferError>
fn try_push_all(&mut self, s: &str) -> Result<(), StringBufferError>
Try to push the entire string into the buffer. If the string is too long or the buffer is
full then nothing is written and Err(NotEnoughSpaceForStr) or Err(BufferFull) is returned
respectively. Read more
Source§impl<const SIZE: usize> Write for StRingBuffer<SIZE>
impl<const SIZE: usize> Write for StRingBuffer<SIZE>
impl<const SIZE: usize> Copy for StRingBuffer<SIZE>
impl<const SIZE: usize> Eq for StRingBuffer<SIZE>
impl<const SIZE: usize> StructuralPartialEq for StRingBuffer<SIZE>
Auto Trait Implementations§
impl<const SIZE: usize> Freeze for StRingBuffer<SIZE>
impl<const SIZE: usize> RefUnwindSafe for StRingBuffer<SIZE>
impl<const SIZE: usize> Send for StRingBuffer<SIZE>
impl<const SIZE: usize> Sync for StRingBuffer<SIZE>
impl<const SIZE: usize> Unpin for StRingBuffer<SIZE>
impl<const SIZE: usize> UnwindSafe for StRingBuffer<SIZE>
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