Skip to main content

Storage

Trait Storage 

Source
pub trait Storage {
    type Sliced<'a>: Storage
       where Self: 'a;

    // Required methods
    fn slice(&self, offset: usize, length: usize) -> Self::Sliced<'_>;
    fn try_read_byte(&self, offset: usize) -> Result<u8, Error>;
    fn len(&self) -> usize;

    // Provided method
    fn is_empty(&self) -> bool { ... }
}

Required Associated Types§

Source

type Sliced<'a>: Storage where Self: 'a

Required Methods§

Source

fn slice(&self, offset: usize, length: usize) -> Self::Sliced<'_>

Source

fn try_read_byte(&self, offset: usize) -> Result<u8, Error>

Source

fn len(&self) -> usize

Provided Methods§

Source

fn is_empty(&self) -> bool

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<T: ?Sized + AsRef<[u8]>> Storage for T

Source§

type Sliced<'b> = &'b [u8] where Self: 'b