pub struct ArrayBuf<T, A>{ /* private fields */ }
Expand description
An array-backed Ring Buffer
A
is the type of the backing array. The backing array must be a real
array. In order to verify this it must satisfy the RealArray
constraint.
In order to create a Ring Buffer backed by an array of 5 integer elements,
the following code can be utilized:
use futures_intrusive::buffer::{ArrayBuf, RingBuf};
type Buffer5 = ArrayBuf<i32, [i32; 5]>;
let buffer = Buffer5::new();
Trait Implementations§
Source§impl<T, A> RingBuf for ArrayBuf<T, A>
impl<T, A> RingBuf for ArrayBuf<T, A>
Source§fn with_capacity(_cap: usize) -> Self
fn with_capacity(_cap: usize) -> Self
Creates a new instance of the Ring Buffer with the given capacity.
RingBuf
implementations are allowed to ignore the capacity
hint and
utilize their default capacity.Source§fn can_push(&self) -> bool
fn can_push(&self) -> bool
Returns true if there is enough space in the buffer to
store another item.
Source§fn push(&mut self, value: Self::Item)
fn push(&mut self, value: Self::Item)
Stores the item at the end of the buffer.
Panics if there is not enough free space.
Auto Trait Implementations§
impl<T, A> Freeze for ArrayBuf<T, A>where
A: Freeze,
impl<T, A> RefUnwindSafe for ArrayBuf<T, A>where
T: RefUnwindSafe,
A: RefUnwindSafe,
impl<T, A> Send for ArrayBuf<T, A>
impl<T, A> Sync for ArrayBuf<T, A>
impl<T, A> Unpin for ArrayBuf<T, A>
impl<T, A> UnwindSafe for ArrayBuf<T, A>where
T: UnwindSafe,
A: 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