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
Trait used in transaction logic, on the ledger witness (SparseLedger
), or on mask
https://github.com/MinaProtocol/mina/blob/05c2f73d0f6e4f1341286843814ce02dcb3919e0/src/lib/mina_base/ledger_intf.ml https://github.com/MinaProtocol/mina/blob/05c2f73d0f6e4f1341286843814ce02dcb3919e0/src/lib/mina_base/sparse_ledger_base.ml
Required Associated Types§
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)
Sourcefn account_locations(&self) -> Vec<Self::Location>
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.