Trait LedgerIntf

Source
pub trait LedgerIntf {
    type Location: Clone + Debug;

    // Required methods
    fn get(&self, addr: &Self::Location) -> Option<Box<Account>>;
    fn location_of_account(
        &self,
        account_id: &AccountId,
    ) -> Option<Self::Location>;
    fn set(&mut self, addr: &Self::Location, account: Box<Account>);
    fn get_or_create(
        &mut self,
        account_id: &AccountId,
    ) -> Result<(AccountState, Box<Account>, Self::Location), String>;
    fn create_new_account(
        &mut self,
        account_id: AccountId,
        account: Account,
    ) -> Result<(), ()>;
    fn remove_accounts_exn(&mut self, account_ids: &[AccountId]);
    fn merkle_root(&mut self) -> Fp;
    fn empty(depth: usize) -> Self;
    fn create_masked(&self) -> Self;
    fn apply_mask(&mut self, mask: Self);
    fn account_locations(&self) -> Vec<Self::Location>;
}
Expand description

Required Associated Types§

Required Methods§

Source

fn get(&self, addr: &Self::Location) -> Option<Box<Account>>

Source

fn location_of_account(&self, account_id: &AccountId) -> Option<Self::Location>

Source

fn set(&mut self, addr: &Self::Location, account: Box<Account>)

Source

fn get_or_create( &mut self, account_id: &AccountId, ) -> Result<(AccountState, Box<Account>, Self::Location), String>

Source

fn create_new_account( &mut self, account_id: AccountId, account: Account, ) -> Result<(), ()>

Source

fn remove_accounts_exn(&mut self, account_ids: &[AccountId])

Source

fn merkle_root(&mut self) -> Fp

Source

fn empty(depth: usize) -> Self

Source

fn create_masked(&self) -> Self

Source

fn apply_mask(&mut self, mask: Self)

Source

fn account_locations(&self) -> Vec<Self::Location>

Returns all account locations in this ledger (and its parents if any)

The result is sorted

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.

Implementors§