[−][src]Struct baffa::stack::Ring
Circular version of Buffer
Because Buffer
is circular, it always has remaining bytes to write.
But care must be taken because without consuming already written bytes, it is easy to over-write
as ring buffer always has capacity.
Implementations
impl<S: Sized> Ring<S>
[src]
pub const fn new() -> Self
[src]
Creates new instance
pub const unsafe fn from_parts(buffer: Buffer<S>, read: usize) -> Self
[src]
Creates new instance from parts
pub const fn into_parts(self) -> (Buffer<S>, usize)
[src]
Creates new instance from parts
pub const fn len(&self) -> usize
[src]
Returns number of available elements
pub const fn is_empty(&self) -> bool
[src]
Returns whether buffer is empty.
pub const fn is_full(&self) -> bool
[src]
Returns whether buffer is full.
Trait Implementations
impl<S: Sized> Buf for Ring<S>
[src]
fn capacity(&self) -> usize
[src]
fn len(&self) -> usize
[src]
fn iter(&self) -> Iter<Self>
[src]
fn iter_mut(&mut self) -> IterMut<Self>
[src]
impl<S: Sized> Index<usize> for Ring<S>
[src]
type Output = u8
The returned type after indexing.
fn index(&self, index: usize) -> &Self::Output
[src]
impl<S: Sized> IndexMut<usize> for Ring<S>
[src]
impl<S: Sized> ReadBuf for Ring<S>
[src]
fn available(&self) -> usize
[src]
unsafe fn consume(&mut self, step: usize)
[src]
unsafe fn read(&mut self, ptr: *mut u8, size: usize)
[src]
fn read_slice(&mut self, bytes: &mut [u8]) -> usize
[src]
impl<S: Sized> WriteBuf for Ring<S>
[src]
Auto Trait Implementations
impl<T> Send for Ring<T> where
T: Send,
T: Send,
impl<T> Sync for Ring<T> where
T: Sync,
T: Sync,
impl<T> Unpin for Ring<T> where
T: Unpin,
T: Unpin,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ReadBufExt for T where
T: ReadBuf,
[src]
T: ReadBuf,
fn read_value<T: Copy + Sized>(&mut self, val: &mut MaybeUninit<T>) -> usize
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> WriteBufExt for T where
T: WriteBuf,
[src]
T: WriteBuf,