Skip to main content

BalanceHolder

Trait BalanceHolder 

Source
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§

Source

fn balance(&self) -> Result<Amount, ArithmeticError>

Returns the balance of the account.

Source

fn try_add_assign(&mut self, other: Amount) -> Result<(), ArithmeticError>

Adds the given amount to the balance.

Source

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".

Implementations on Foreign Types§

Source§

impl BalanceHolder for Amount

Implementors§