pub struct BudgetTarget {
pub id: BudgetTargetId,
pub category_id: CategoryId,
pub amount: Money,
pub cadence: TargetCadence,
pub notes: String,
pub active: bool,
pub created_at: DateTime<Utc>,
pub updated_at: DateTime<Utc>,
}Expand description
A budget target for a category
Fields§
§id: BudgetTargetId§category_id: CategoryId§amount: Money§cadence: TargetCadence§notes: String§active: bool§created_at: DateTime<Utc>§updated_at: DateTime<Utc>Implementations§
Source§impl BudgetTarget
impl BudgetTarget
pub fn new( category_id: CategoryId, amount: Money, cadence: TargetCadence, ) -> Self
pub fn monthly(category_id: CategoryId, amount: Money) -> Self
pub fn weekly(category_id: CategoryId, amount: Money) -> Self
pub fn yearly(category_id: CategoryId, amount: Money) -> Self
pub fn calculate_for_period(&self, period: &BudgetPeriod) -> Money
pub fn set_amount(&mut self, amount: Money)
pub fn set_cadence(&mut self, cadence: TargetCadence)
pub fn activate(&mut self)
pub fn deactivate(&mut self)
pub fn validate(&self) -> Result<(), TargetValidationError>
Trait Implementations§
Source§impl Clone for BudgetTarget
impl Clone for BudgetTarget
Source§fn clone(&self) -> BudgetTarget
fn clone(&self) -> BudgetTarget
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for BudgetTarget
impl Debug for BudgetTarget
Source§impl<'de> Deserialize<'de> for BudgetTarget
impl<'de> Deserialize<'de> for BudgetTarget
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
Source§impl Display for BudgetTarget
impl Display for BudgetTarget
Auto Trait Implementations§
impl Freeze for BudgetTarget
impl RefUnwindSafe for BudgetTarget
impl Send for BudgetTarget
impl Sync for BudgetTarget
impl Unpin for BudgetTarget
impl UnwindSafe for BudgetTarget
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