pub struct Account {
pub id: AccountId,
pub name: String,
pub account_type: AccountType,
pub on_budget: bool,
pub archived: bool,
pub starting_balance: Money,
pub notes: String,
pub last_reconciled_date: Option<NaiveDate>,
pub last_reconciled_balance: Option<Money>,
pub created_at: DateTime<Utc>,
pub updated_at: DateTime<Utc>,
pub sort_order: i32,
}Expand description
A financial account
Fields§
§id: AccountIdUnique identifier
name: StringAccount name (e.g., “Chase Checking”)
account_type: AccountTypeType of account
on_budget: boolWhether this account is included in the budget Off-budget accounts (like investments) don’t affect Available to Budget
archived: boolWhether this account is archived (soft-deleted)
starting_balance: MoneyOpening balance when the account was created
notes: StringNotes about this account
last_reconciled_date: Option<NaiveDate>Date of last reconciliation
last_reconciled_balance: Option<Money>Balance at last reconciliation
created_at: DateTime<Utc>When the account was created
updated_at: DateTime<Utc>When the account was last modified
sort_order: i32Sort order for display
Implementations§
Source§impl Account
impl Account
Sourcepub fn new(name: impl Into<String>, account_type: AccountType) -> Self
pub fn new(name: impl Into<String>, account_type: AccountType) -> Self
Create a new account with default values
Sourcepub fn with_starting_balance(
name: impl Into<String>,
account_type: AccountType,
starting_balance: Money,
) -> Self
pub fn with_starting_balance( name: impl Into<String>, account_type: AccountType, starting_balance: Money, ) -> Self
Create a new account with a starting balance
Sourcepub fn set_on_budget(&mut self, on_budget: bool)
pub fn set_on_budget(&mut self, on_budget: bool)
Set whether this account is on-budget
Sourcepub fn validate(&self) -> Result<(), AccountValidationError>
pub fn validate(&self) -> Result<(), AccountValidationError>
Validate the account
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Account
impl<'de> Deserialize<'de> for Account
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for Account
impl RefUnwindSafe for Account
impl Send for Account
impl Sync for Account
impl Unpin for Account
impl UnwindSafe for Account
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> ToCompactString for Twhere
T: Display,
impl<T> ToCompactString for Twhere
T: Display,
Source§fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
Fallible version of
ToCompactString::to_compact_string() Read moreSource§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
Converts the given value to a
CompactString. Read more