Trait canonical::Store[][src]

pub trait Store: 'static + Clone + Default {
    type Ident: Ident;
    type Error: From<InvalidEncoding> + Debug + Send + Sync;
    fn fetch(
        &self,
        id: &Self::Ident,
        into: &mut [u8]
    ) -> Result<(), Self::Error>;
fn get<T: Canon<Self>>(&self, id: &Self::Ident) -> Result<T, Self::Error>;
fn put<T: Canon<Self>>(&self, t: &T) -> Result<Self::Ident, Self::Error>;
fn put_raw(&self, bytes: &[u8]) -> Result<Self::Ident, Self::Error>; fn ident<T: Canon<Self>>(t: &T) -> Self::Ident { ... } }

The main trait for storing/transmitting data, in the case of a wasm environment, this is generally implemented with host calls

Associated Types

type Ident: Ident[src]

The identifier used for allocations

type Error: From<InvalidEncoding> + Debug + Send + Sync[src]

The error the store can emit

Loading content...

Required methods

fn fetch(&self, id: &Self::Ident, into: &mut [u8]) -> Result<(), Self::Error>[src]

Write bytes associated with Ident

fn get<T: Canon<Self>>(&self, id: &Self::Ident) -> Result<T, Self::Error>[src]

Get a value from storage, given an identifier

fn put<T: Canon<Self>>(&self, t: &T) -> Result<Self::Ident, Self::Error>[src]

Encode a value into the store

fn put_raw(&self, bytes: &[u8]) -> Result<Self::Ident, Self::Error>[src]

Put raw bytes in store

Loading content...

Provided methods

fn ident<T: Canon<Self>>(t: &T) -> Self::Ident[src]

Calculate the Identifier of a type without storing it

Loading content...

Implementors

impl<I> Store for BridgeStore<I> where
    I: 'static + Ident
[src]

type Ident = I

type Error = InvalidEncoding

Loading content...