From 581c06fc2fb45760859badbb05912cf94a07f9fc Mon Sep 17 00:00:00 2001 From: Musselman Date: Thu, 22 Aug 2024 15:46:09 -0500 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=A8=20Feature:=20Add=20basic=20data=20?= =?UTF-8?q?structures?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This includes structures for accounts, common account errors, and transactions --- src/main.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main.rs b/src/main.rs index ea67130..28e0e06 100644 --- a/src/main.rs +++ b/src/main.rs @@ -5,6 +5,9 @@ use std::collections::HashMap; #[derive(Debug)] enum AccountingError { // Add variants here for account not found, account underfunded and account overfunded + AccountNotFound(String) , + AccountUnderFunded(String, u64), + AccountOverFunded(String, u64), } /// A transaction type. Transactions should be able to rebuild a ledger's state @@ -12,12 +15,15 @@ enum AccountingError { #[derive(Debug)] pub enum Tx { // Add variants for storing withdraw/deposit transactions + Withdraw{account:String, amount:u64}, + Deposit{account:String, amount:u64}, } /// A type for managing accounts and their current currency balance #[derive(Debug)] struct Accounts { // Add a property `accounts` here + accounts: HashMap, } impl Accounts {