pub fn debit(&mut self, from: &AccountIdentifier, amount: ICPTs) {
        self.store.update(*from, |prev| {
            let mut balance = match prev {
                Some(x) => *x,
                None => panic!("You tried to withdraw funds from empty account {}", from),
            };
            // This is technically redundant because Amount uses checked arithmetic, but
            // belt an braces
            assert!(
                balance >= amount,
                "You have tried to spend more than the balance of your account"
            );
            balance -= amount;
            balance
        });
    }
// Debiting an account will automatically remove it from the `inner`
// HashMap if the balance reaches zero.
Debiting an account will automatically remove it from the `inner`
HashMap if the balance reaches zero.
Debiting an account will automatically remove it from the ` inner ` HashMap if the balance reaches zero .
pub fn debit(&mut self, from: &AccountIdentifier, amount: ICPTs) {
        self.store.update(*from, |prev| {
            let mut balance = match prev {
                Some(x) => *x,
                None => panic!("You tried to withdraw funds from empty account {}", from),
            };
            // This is technically redundant because Amount uses checked arithmetic, but
            // belt an braces
            assert!(
                balance >= amount,
                "You have tried to spend more than the balance of your account"
            );
            balance -= amount;
            balance
        });
    }
pub fn debit ( & mut self , from : & AccountIdentifier , amount : ICPTs ) { self . store . update ( * from , | prev | { let mut balance = match prev { Some ( x ) => * x , None => panic ! ( " " from ) , } ; // This is technically redundant because Amount uses checked arithmetic, but // belt an braces assert ! ( balance amount " " ) ; balance -= amount ; balance } ) ; }
Debiting an account will automatically remove it from the `inner`
HashMap if the balance reaches zero.
Debiting an account will automatically remove it from the ` inner ` HashMap if the balance reaches zero .
&mut self
from
&AccountIdentifier
amount
ICPTs
&mut self
from
&AccountIdentifier
amount
ICPTs