Skip to main content

Storage

Trait Storage 

Source
pub trait Storage {
    const SUPPORTS_GROW: bool = false;

    // Required methods
    fn allocate(&mut self, size: usize) -> Result<(), Status>;
    fn get_data(&self) -> &[usize];
    fn get_data_mut(&mut self) -> &mut [usize];

    // Provided method
    fn grow(&mut self, _size: usize) -> Result<(), Status> { ... }
}
Expand description

Trait for the backing storage of a raw bitmap.

Provided Associated Constants§

Source

const SUPPORTS_GROW: bool = false

True if this storage supports growing.

Required Methods§

Source

fn allocate(&mut self, size: usize) -> Result<(), Status>

Allocates at least size bytes of storage.

Source

fn get_data(&self) -> &[usize]

Returns a read-only slice of usize words to the underlying storage.

Source

fn get_data_mut(&mut self) -> &mut [usize]

Returns a mutable slice of usize words to the underlying storage.

Provided Methods§

Source

fn grow(&mut self, _size: usize) -> Result<(), Status>

Optionally grows the storage to at least size bytes.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§