pub enum BudgetPeriod {
Monthly {
year: i32,
month: u32,
},
Weekly {
year: i32,
week: u32,
},
BiWeekly {
start_date: NaiveDate,
},
Custom {
start: NaiveDate,
end: NaiveDate,
},
}Expand description
Represents a budget period
Variants§
Monthly
Monthly period (e.g., “2025-01”)
Weekly
ISO week period (e.g., “2025-W03”)
BiWeekly
Bi-weekly period (identified by start date)
Custom
Custom date range
Implementations§
Source§impl BudgetPeriod
impl BudgetPeriod
Sourcepub fn bi_weekly(start_date: NaiveDate) -> Self
pub fn bi_weekly(start_date: NaiveDate) -> Self
Create a bi-weekly period starting on the given date
Sourcepub fn current_month() -> Self
pub fn current_month() -> Self
Get the current monthly period
Sourcepub fn current_week() -> Self
pub fn current_week() -> Self
Get the current weekly period
Sourcepub fn start_date(&self) -> NaiveDate
pub fn start_date(&self) -> NaiveDate
Get the start date of this period
Sourcepub fn parse(s: &str) -> Result<Self, PeriodParseError>
pub fn parse(s: &str) -> Result<Self, PeriodParseError>
Parse a period string
Formats:
- Monthly: “2025-01”
- Weekly: “2025-W03”
- Custom: “2025-01-01..2025-01-15”
Trait Implementations§
Source§impl Clone for BudgetPeriod
impl Clone for BudgetPeriod
Source§fn clone(&self) -> BudgetPeriod
fn clone(&self) -> BudgetPeriod
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 BudgetPeriod
impl Debug for BudgetPeriod
Source§impl<'de> Deserialize<'de> for BudgetPeriod
impl<'de> Deserialize<'de> for BudgetPeriod
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 BudgetPeriod
impl Display for BudgetPeriod
Source§impl Hash for BudgetPeriod
impl Hash for BudgetPeriod
Source§impl Ord for BudgetPeriod
impl Ord for BudgetPeriod
Source§impl PartialEq for BudgetPeriod
impl PartialEq for BudgetPeriod
Source§impl PartialOrd for BudgetPeriod
impl PartialOrd for BudgetPeriod
Source§impl Serialize for BudgetPeriod
impl Serialize for BudgetPeriod
impl Eq for BudgetPeriod
impl StructuralPartialEq for BudgetPeriod
Auto Trait Implementations§
impl Freeze for BudgetPeriod
impl RefUnwindSafe for BudgetPeriod
impl Send for BudgetPeriod
impl Sync for BudgetPeriod
impl Unpin for BudgetPeriod
impl UnwindSafe for BudgetPeriod
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<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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