pub struct HeapBuffer<T>(_);
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

Creates a buffer with the provided capacity. All elements in the buffer will be initialized to the item’s default value.

Trait Implementations

Converts this type into a shared reference of the (usually inferred) input type.

Converts to this type from the input type.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Gets the capacity of the array, or in other words the upper bound for ranges passed into slice and slice_mut before they will panic. Read more

Gets a slice of elements in the range provided. The length of the slice will always match the length of the range. Read more

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

Gets a mutable slice of elements in the range provided. The length of the slice will always match the length of the range. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.