pub trait AccountTreeStorage {
// Required methods
fn root(&self) -> Word;
fn num_accounts(&self) -> usize;
fn open(&self, account_id: AccountId) -> AccountWitness;
fn get(&self, account_id: AccountId) -> Word;
fn compute_mutations(
&self,
accounts: impl IntoIterator<Item = (AccountId, Word)>,
) -> Result<AccountMutationSet, AccountTreeError>;
fn apply_mutations_with_reversion(
&mut self,
mutations: AccountMutationSet,
) -> Result<AccountMutationSet, AccountTreeError>;
fn contains_account_id_prefix(&self, prefix: AccountIdPrefix) -> bool;
}Expand description
Trait abstracting operations over different account tree backends.
Required Methods§
Sourcefn num_accounts(&self) -> usize
fn num_accounts(&self) -> usize
Returns the number of accounts in the tree.
Sourcefn open(&self, account_id: AccountId) -> AccountWitness
fn open(&self, account_id: AccountId) -> AccountWitness
Opens an account and returns its witness.
Sourcefn compute_mutations(
&self,
accounts: impl IntoIterator<Item = (AccountId, Word)>,
) -> Result<AccountMutationSet, AccountTreeError>
fn compute_mutations( &self, accounts: impl IntoIterator<Item = (AccountId, Word)>, ) -> Result<AccountMutationSet, AccountTreeError>
Computes mutations for applying account updates.
Sourcefn apply_mutations_with_reversion(
&mut self,
mutations: AccountMutationSet,
) -> Result<AccountMutationSet, AccountTreeError>
fn apply_mutations_with_reversion( &mut self, mutations: AccountMutationSet, ) -> Result<AccountMutationSet, AccountTreeError>
Applies mutations with reversion data.
Sourcefn contains_account_id_prefix(&self, prefix: AccountIdPrefix) -> bool
fn contains_account_id_prefix(&self, prefix: AccountIdPrefix) -> bool
Checks if the tree contains an account with the given prefix.
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.