[][src]Trait store::StoreItem

pub trait StoreItem: Sized {
    fn db_column() -> DBColumn;
fn as_store_bytes(&self) -> Vec<u8>;
fn from_store_bytes(bytes: &mut [u8]) -> Result<Self, Error>; fn db_put(&self, store: &impl Store, key: &Hash256) -> Result<(), Error> { ... }
fn db_get(store: &impl Store, key: &Hash256) -> Result<Option<Self>, Error> { ... }
fn db_exists(store: &impl Store, key: &Hash256) -> Result<bool, Error> { ... }
fn db_delete(store: &impl Store, key: &Hash256) -> Result<(), Error> { ... } }

An item that may be stored in a Store.

Provides default methods that are suitable for most applications, however when overridden they provide full customizability of Store operations.

Required methods

fn db_column() -> DBColumn

Identifies which column this item should be placed in.

fn as_store_bytes(&self) -> Vec<u8>

Serialize self as bytes.

fn from_store_bytes(bytes: &mut [u8]) -> Result<Self, Error>

De-serialize self from bytes.

Loading content...

Provided methods

fn db_put(&self, store: &impl Store, key: &Hash256) -> Result<(), Error>

Store self.

fn db_get(store: &impl Store, key: &Hash256) -> Result<Option<Self>, Error>

Retrieve an instance of Self.

fn db_exists(store: &impl Store, key: &Hash256) -> Result<bool, Error>

Return true if an instance of Self exists in Store.

fn db_delete(store: &impl Store, key: &Hash256) -> Result<(), Error>

Delete self from the Store.

Loading content...

Implementors

impl<T: EthSpec> StoreItem for BeaconBlock<T>[src]

impl<T: EthSpec> StoreItem for BeaconState<T>[src]

Loading content...