Struct mini_io_queue::storage::StackBuffer
source · [−]pub struct StackBuffer<T, const N: usize>(_);
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
sourceimpl<T, const N: usize> AsRef<[UnsafeCell<T>]> for StackBuffer<T, N>
impl<T, const N: usize> AsRef<[UnsafeCell<T>]> for StackBuffer<T, N>
sourcefn as_ref(&self) -> &[UnsafeCell<T>]
fn as_ref(&self) -> &[UnsafeCell<T>]
Converts this type into a shared reference of the (usually inferred) input type.
sourceimpl<T, const N: usize> Default for StackBuffer<T, N> where
T: Default,
impl<T, const N: usize> Default for StackBuffer<T, N> where
T: Default,
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> !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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
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
sourceimpl<T, A> Storage<T> for A where
A: AsRef<[UnsafeCell<T>]>,
impl<T, A> Storage<T> for A where
A: AsRef<[UnsafeCell<T>]>,
sourcefn slice(&self, range: Range<usize>) -> &[T]ⓘNotable traits for &[u8]impl Read for &[u8]impl Write for &mut [u8]
fn slice(&self, range: Range<usize>) -> &[T]ⓘNotable traits for &[u8]impl Read for &[u8]impl Write for &mut [u8]
Gets a slice of elements in the range provided. The length of the slice will always match the length of the range. Read more
sourceunsafe fn slice_mut_unchecked(&self, range: Range<usize>) -> &mut [T]ⓘNotable traits for &[u8]impl Read for &[u8]impl Write for &mut [u8]
unsafe fn slice_mut_unchecked(&self, range: Range<usize>) -> &mut [T]ⓘNotable traits for &[u8]impl Read for &[u8]impl Write for &mut [u8]
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