pub unsafe trait Storage {
type Item: Sized;
// Required methods
fn len(&self) -> usize;
fn as_mut_ptr(&self) -> *mut MaybeUninit<Self::Item>;
// Provided methods
fn is_empty(&self) -> bool { ... }
fn as_ptr(&self) -> *const MaybeUninit<Self::Item> { ... }
unsafe fn slice(&self, range: Range<usize>) -> &[MaybeUninit<Self::Item>] { ... }
unsafe fn slice_mut(
&self,
range: Range<usize>,
) -> &mut [MaybeUninit<Self::Item>] { ... }
}
Expand description
Abstract storage for the ring buffer.
Storage items must be stored as a contiguous array.
§Safety
Must not alias with its contents (it must be safe to store mutable references to storage itself and to its data at the same time).
Self::as_mut_ptr
must point to underlying data.
Self::len
must always return the same value.
Required Associated Types§
Required Methods§
Sourcefn as_mut_ptr(&self) -> *mut MaybeUninit<Self::Item>
fn as_mut_ptr(&self) -> *mut MaybeUninit<Self::Item>
Return mutable pointer to the beginning of the storage items.
Provided Methods§
fn is_empty(&self) -> bool
Sourcefn as_ptr(&self) -> *const MaybeUninit<Self::Item>
fn as_ptr(&self) -> *const MaybeUninit<Self::Item>
Return pointer to the beginning of the storage items.