[][src]Struct baffa::stack::Ring

pub struct Ring<T: Sized> { /* fields omitted */ }

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]

impl<S: Sized> Index<usize> for Ring<S>[src]

type Output = u8

The returned type after indexing.

impl<S: Sized> IndexMut<usize> for Ring<S>[src]

impl<S: Sized> ReadBuf for Ring<S>[src]

impl<S: Sized> WriteBuf for Ring<S>[src]

Auto Trait Implementations

impl<T> Send for Ring<T> where
    T: Send

impl<T> Sync for Ring<T> where
    T: Sync

impl<T> Unpin for Ring<T> where
    T: Unpin

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ReadBufExt for T where
    T: ReadBuf
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> WriteBufExt for T where
    T: WriteBuf
[src]