pub trait BalanceHolder {
// Required methods
fn balance(&self) -> Result<Amount, ArithmeticError>;
fn try_add_assign(&mut self, other: Amount) -> Result<(), ArithmeticError>;
fn try_sub_assign(&mut self, other: Amount) -> Result<(), ArithmeticError>;
}Expand description
How to access the balance of an account.
Required Methods§
Sourcefn balance(&self) -> Result<Amount, ArithmeticError>
fn balance(&self) -> Result<Amount, ArithmeticError>
Returns the balance of the account.
Sourcefn try_add_assign(&mut self, other: Amount) -> Result<(), ArithmeticError>
fn try_add_assign(&mut self, other: Amount) -> Result<(), ArithmeticError>
Adds the given amount to the balance.
Sourcefn try_sub_assign(&mut self, other: Amount) -> Result<(), ArithmeticError>
fn try_sub_assign(&mut self, other: Amount) -> Result<(), ArithmeticError>
Subtracts the given amount from the balance.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".