fix to isize

This commit is contained in:
Lewis Diamond 2021-03-14 21:49:18 -04:00
parent 5c28458afd
commit 6f8eed4412
2 changed files with 7 additions and 7 deletions

View File

@ -9,7 +9,7 @@ impl MemActStore {
MemActStore(HashMap::new())
}
fn add_or_sub_balance(&mut self, client: &u16, amnt: usize, sub: bool) -> usize {
fn add_or_sub_balance(&mut self, client: &u16, amnt: isize, sub: bool) -> isize {
let act = self
.0
.entry(*client)
@ -24,15 +24,15 @@ impl MemActStore {
}
impl ActStore for MemActStore {
fn add_to_balance(&mut self, client: &u16, amnt: usize) -> usize {
fn add_to_balance(&mut self, client: &u16, amnt: isize) -> isize {
self.add_or_sub_balance(client, amnt, false)
}
fn sub_from_balance(&mut self, client: &u16, amnt: usize) -> usize {
fn sub_from_balance(&mut self, client: &u16, amnt: isize) -> isize {
self.add_or_sub_balance(client, amnt, true)
}
fn hold_amount(&mut self, client: u16, amnt: usize) {
fn hold_amount(&mut self, client: u16, amnt: isize) {
todo!()
}

View File

@ -6,9 +6,9 @@ use crate::types::Account;
pub trait ActStore {
fn get_account(&self, client: &u16) -> Option<&Account>;
fn add_to_balance(&mut self, client: &u16, amnt: usize) -> usize;
fn sub_from_balance(&mut self, client: &u16, amnt: usize) -> usize;
fn hold_amount(&mut self, client:u16, amnt: usize);
fn add_to_balance(&mut self, client: &u16, amnt: isize) -> isize;
fn sub_from_balance(&mut self, client: &u16, amnt: isize) -> isize;
fn hold_amount(&mut self, client:u16, amnt: isize);
fn lock_account(&mut self, client: u16);
fn unlock_account(&mut self, client: u16);