pub struct HeapBuffer<T>(/* private fields */);
Available on crate feature
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§
Source§impl<T> AsRef<[UnsafeCell<T>]> for HeapBuffer<T>
impl<T> AsRef<[UnsafeCell<T>]> for HeapBuffer<T>
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.
Source§impl<T> Debug for HeapBuffer<T>where
T: Debug,
impl<T> Debug for HeapBuffer<T>where
T: Debug,
impl<T> Send for HeapBuffer<T>where
T: Send,
impl<T> Sync for HeapBuffer<T>where
T: Sync,
Auto Trait Implementations§
impl<T> Freeze for HeapBuffer<T>
impl<T> !RefUnwindSafe for HeapBuffer<T>
impl<T> Unpin for HeapBuffer<T>
impl<T> UnwindSafe for HeapBuffer<T>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