pub unsafe trait Storage<R: LayoutSpec>: Sized {
    fn get_ptr(&self) -> *const u8;
fn get_mut_ptr(&mut self) -> *mut u8;
fn capacity(&self) -> usize; }
Expand description

An interface to a contiguous memory block for use by data structures.

Required methods

Extracts a pointer to the beginning of the memory block.

Safety

Implementors must ensure the same pointer is returned every time this method is called throughout the block’s lifetime.

Extracts a mutable pointer to the beginning of the memory block.

Safety

Implementors must ensure the same pointer is returned every time this method is called throughout the block’s lifetime.

Returns the maximum number of items the memory block can hold.

Safety

What exactly constitutes an item depends on the argument type R. When called on a memory block with a layout matching R::layout_with_capacity(n), this must return at most n.

Implementors must ensure the same value is returned every time this method is called throughout the block’s lifetime.

Implementations on Foreign Types

Implementors