pub struct Month { /* private fields */ }Expand description
A calendar month. As a valuation date it means the end of that month.
use prospicio_core::Month;
let m = Month::new(2021, 11).unwrap();
assert_eq!(m.add_months(3), Month::new(2022, 2).unwrap());
assert_eq!(m.to_string(), "2021-11");Implementations§
Source§impl Month
impl Month
Sourcepub fn add_months(self, n: i64) -> Self
pub fn add_months(self, n: i64) -> Self
The month n months later (earlier if n is negative).
Sourcepub const fn months_since(self, earlier: Month) -> i64
pub const fn months_since(self, earlier: Month) -> i64
Whole months from earlier to self (negative if self is earlier).
Trait Implementations§
impl Copy for Month
impl Eq for Month
Source§impl Ord for Month
impl Ord for Month
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialOrd for Month
impl PartialOrd for Month
impl StructuralPartialEq for Month
Auto Trait Implementations§
impl Freeze for Month
impl RefUnwindSafe for Month
impl Send for Month
impl Sync for Month
impl Unpin for Month
impl UnsafeUnpin for Month
impl UnwindSafe for Month
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