Struct mini_io_queue::storage::HeapBuffer
source · [−]pub struct HeapBuffer<T>(_);
heap-buffer
only.Expand description
Backing buffer for a queue, allocated on the heap.
All queues require a backing buffer which implements the Storage
trait. This buffer stores
values in a contiguous array allocated on the heap. Compare this to StackBuffer
which uses
a contiguous array on the stack. Note that the asyncio
, blocking
and nonblocking
queues move their buffer to the heap anyway.
Example
use mini_io_queue::nonblocking;
use mini_io_queue::storage::HeapBuffer;
let buffer: HeapBuffer<u8> = HeapBuffer::new(100);
let (reader, writer) = nonblocking::queue_from(buffer);
Implementations
Trait Implementations
sourceimpl<T> AsRef<[UnsafeCell<T>]> for HeapBuffer<T>
impl<T> AsRef<[UnsafeCell<T>]> for HeapBuffer<T>
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.
impl<T> Send for HeapBuffer<T> where
T: Send,
impl<T> Sync for HeapBuffer<T> where
T: Sync,
Auto Trait Implementations
impl<T> !RefUnwindSafe for HeapBuffer<T>
impl<T> Unpin for HeapBuffer<T>
impl<T> UnwindSafe for HeapBuffer<T> 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