pub struct StackBuffer<T, const N: usize>(/* private fields */);
Available on crate feature
stack-buffer
only.Expand description
Backing buffer for a queue, allocated on the stack.
All queues require a backing buffer which implements the Storage
trait. This buffer stores
values in a contiguous array allocated on the stack. Compare this to HeapBuffer
which uses
a contiguous array on the heap. Note that both the asyncio
and nonblocking
queues move
their buffer to the heap anyway.
§Example
use mini_io_queue::nonblocking;
use mini_io_queue::storage::StackBuffer;
let buffer: StackBuffer<u8, 100> = StackBuffer::default();
let (reader, writer) = nonblocking::queue_from(buffer);
Trait Implementations§
Source§impl<T, const N: usize> AsRef<[UnsafeCell<T>]> for StackBuffer<T, N>
impl<T, const N: usize> AsRef<[UnsafeCell<T>]> for StackBuffer<T, N>
Source§fn as_ref(&self) -> &[UnsafeCell<T>]
fn as_ref(&self) -> &[UnsafeCell<T>]
Converts this type into a shared reference of the (usually inferred) input type.
impl<T, const N: usize> Send for StackBuffer<T, N>where
T: Send,
impl<T, const N: usize> Sync for StackBuffer<T, N>where
T: Sync,
Auto Trait Implementations§
impl<T, const N: usize> !Freeze for StackBuffer<T, N>
impl<T, const N: usize> !RefUnwindSafe for StackBuffer<T, N>
impl<T, const N: usize> Unpin for StackBuffer<T, N>where
T: Unpin,
impl<T, const N: usize> UnwindSafe for StackBuffer<T, N>where
T: 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
Source§impl<T, A> Storage<T> for Awhere
A: AsRef<[UnsafeCell<T>]>,
impl<T, A> Storage<T> for Awhere
A: AsRef<[UnsafeCell<T>]>,
Source§fn slice(&self, range: Range<usize>) -> &[T]
fn slice(&self, range: Range<usize>) -> &[T]
Gets a slice of elements in the range provided. The length of the slice will always match
the length of the range. Read more
Source§unsafe fn slice_mut_unchecked(&self, range: Range<usize>) -> &mut [T]
unsafe fn slice_mut_unchecked(&self, range: Range<usize>) -> &mut [T]
Gets a mutable slice of elements in the range provided. The length of the slice will always
match the length of the range. This function is unchecked and unsafe because it does not
ensure there are no other references overlapping with the range, which is against Rust’s
borrowing rules and is very unsafe! Read more