pub trait AccumulateOps {
type Error: Debug;
// Required methods
fn get(&self, key: &StorageKey) -> Option<Cow<'_, [u8]>>;
fn set(
&mut self,
key: StorageKey,
value: Cow<'_, [u8]>,
) -> Result<(), Self::Error>;
fn remove(&mut self, key: &StorageKey);
// Provided methods
fn set_typed(
&mut self,
key: StorageKey,
value: &impl Encode,
) -> Result<(), Self::Error> { ... }
fn get_typed<T: Decode>(&self, key: &StorageKey) -> Result<Option<T>, Error> { ... }
}Expand description
Operations that AccumulateEngine uses during accumulation.
Each operation corresponds to a JAM host-call.
Required Associated Types§
Required Methods§
Sourcefn get(&self, key: &StorageKey) -> Option<Cow<'_, [u8]>>
fn get(&self, key: &StorageKey) -> Option<Cow<'_, [u8]>>
Read value under the specified key from the storage.
Sourcefn set(
&mut self,
key: StorageKey,
value: Cow<'_, [u8]>,
) -> Result<(), Self::Error>
fn set( &mut self, key: StorageKey, value: Cow<'_, [u8]>, ) -> Result<(), Self::Error>
Write value under the specified key to the storage.
Sourcefn remove(&mut self, key: &StorageKey)
fn remove(&mut self, key: &StorageKey)
Read value under the specified key from the storage.
Provided Methods§
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.