LocalVmemRBMut

Type Alias LocalVmemRBMut 

Source
pub type LocalVmemRBMut<T> = OneRingBuf<VmemStorage<T>, LocalCompMut>;
Available on crate feature alloc and crate feature vmem and Unix only.
Expand description

Mutable ring buffer using virtual memory storage suitable for single-threaded usage.

Aliased Type§

pub struct LocalVmemRBMut<T> { /* private fields */ }

Implementations§

Source§

impl<T> LocalVmemRBMut<T>

Source

pub unsafe fn new_zeroed(capacity: usize) -> Self

Available on crate feature vmem and Unix and crate feature alloc only.

Creates a new LocalVmemRBMut with given capacity and zeroed (uninitialised) elements.

§Safety

The buffer must be then initialised using proper ProdIter methods (*_init ones).

§Behaviour with vmem feature

When vmem feature is enabled, the capacity of the buffer must be a multiple of the system’s page size. This method accepts a minimum size, which will then be used to compute the actual size (equal to or greater than it).

Source

pub fn default(capacity: usize) -> Self
where T: Default + Clone,

Available on crate feature vmem and Unix and crate feature alloc only.

Creates a new LocalVmemRBMut with given capacity and elements initialised to default.

§Behaviour with vmem feature

When vmem feature is enabled, the capacity of the buffer must be a multiple of the system’s page size. This method accepts a minimum size, which will then be used to compute the actual size (equal to or greater than it).

Trait Implementations§

Source§

impl<T> From<Vec<T>> for LocalVmemRBMut<T>

Available on crate feature vmem and Unix and crate feature alloc only.
Source§

fn from(value: Vec<T>) -> Self

Converts a Vec<T> into a LocalVmemRBMut. Note that the length of the buffer will be equal to the length of the vector, and not to its capacity.

§Behaviour with vmem feature

When vmem feature is enabled, the capacity of the buffer must be a multiple of the system’s page size, so must be the length of the passed Vec. Please, use crate::utils::vmem_helper::get_page_size_mul to get a suitable length.