[−][src]Trait canonical_host::Store
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
The identifier used for allocations
type Error: From<InvalidEncoding> + Debug
The error the store can emit
Required methods
fn fetch(&self, id: &Self::Ident, into: &mut [u8]) -> Result<(), Self::Error>
Write bytes associated with Ident
fn get<T>(&self, id: &Self::Ident) -> Result<T, Self::Error> where
T: Canon<Self>,
T: Canon<Self>,
Get a value from storage, given an identifier
fn put<T>(&self, t: &T) -> Result<Self::Ident, Self::Error> where
T: Canon<Self>,
T: Canon<Self>,
Encode a value into the store
fn put_raw(&self, bytes: &[u8]) -> Result<Self::Ident, Self::Error>
Put raw bytes in store
Provided methods
fn ident<T>(t: &T) -> Self::Ident where
T: Canon<Self>,
T: Canon<Self>,
Calculate the Identifier of a type without storing it
Implementations on Foreign Types
impl<I> Store for BridgeStore<I> where
I: 'static + Ident,
[src]
I: 'static + Ident,
type Ident = I
type Error = InvalidEncoding
fn fetch(
&self,
id: &<BridgeStore<I> as Store>::Ident,
into: &mut [u8]
) -> Result<(), <BridgeStore<I> as Store>::Error>
[src]
&self,
id: &<BridgeStore<I> as Store>::Ident,
into: &mut [u8]
) -> Result<(), <BridgeStore<I> as Store>::Error>
fn get<T>(
&self,
id: &<BridgeStore<I> as Store>::Ident
) -> Result<T, <BridgeStore<I> as Store>::Error> where
T: Canon<BridgeStore<I>>,
[src]
&self,
id: &<BridgeStore<I> as Store>::Ident
) -> Result<T, <BridgeStore<I> as Store>::Error> where
T: Canon<BridgeStore<I>>,
fn put<T>(
&self,
t: &T
) -> Result<<BridgeStore<I> as Store>::Ident, <BridgeStore<I> as Store>::Error> where
T: Canon<BridgeStore<I>>,
[src]
&self,
t: &T
) -> Result<<BridgeStore<I> as Store>::Ident, <BridgeStore<I> as Store>::Error> where
T: Canon<BridgeStore<I>>,
fn put_raw(
&self,
bytes: &[u8]
) -> Result<<BridgeStore<I> as Store>::Ident, <BridgeStore<I> as Store>::Error>
[src]
&self,
bytes: &[u8]
) -> Result<<BridgeStore<I> as Store>::Ident, <BridgeStore<I> as Store>::Error>