Struct futures_intrusive::buffer::ArrayBuf
source · 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
sourceimpl<T, A> RingBuf for ArrayBuf<T, A>where
A: AsMut<[T]> + AsRef<[T]> + RealArray<T>,
impl<T, A> RingBuf for ArrayBuf<T, A>where
A: AsMut<[T]> + AsRef<[T]> + RealArray<T>,
type Item = T
type Item = T
The type of stored items inside the Ring Buffer
sourcefn 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. Read moresourcefn can_push(&self) -> bool
fn can_push(&self) -> bool
Returns true if there is enough space in the buffer to
store another item. Read more
sourcefn 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. Read more
Auto Trait Implementations
impl<T, A> RefUnwindSafe for ArrayBuf<T, A>where
A: RefUnwindSafe,
T: RefUnwindSafe,
impl<T, A> Send for ArrayBuf<T, A>where
A: Send,
T: Send,
impl<T, A> Sync for ArrayBuf<T, A>where
A: Sync,
T: Sync,
impl<T, A> Unpin for ArrayBuf<T, A>where
A: Unpin,
T: Unpin,
impl<T, A> UnwindSafe for ArrayBuf<T, A>where
A: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more