Struct beancount_parser::Date
source · pub struct Date {
pub year: u16,
pub month: u8,
pub day: u8,
}
Expand description
A date
The parser has some sanity checks to make sure the date remotely makes sense but it doesn’t verify if it is an actual real valid date.
If that is important to you, you should use a date-time library to verify the validity.
§Example
let input = "2022-05-21 event \"location\" \"Middle earth\"";
let beancount: BeancountFile<f64> = input.parse().unwrap();
let date = beancount.directives[0].date;
assert_eq!(date.year, 2022);
assert_eq!(date.month, 5);
assert_eq!(date.day, 21);
Fields§
§year: u16
Year
month: u8
Month (of year)
day: u8
Day (of month)
Implementations§
Trait Implementations§
source§impl Ord for Date
impl Ord for Date
source§impl PartialEq for Date
impl PartialEq for Date
source§impl PartialOrd for Date
impl PartialOrd for Date
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moreimpl Copy for Date
impl Eq for Date
impl StructuralPartialEq for Date
Auto Trait Implementations§
impl Freeze for Date
impl RefUnwindSafe for Date
impl Send for Date
impl Sync for Date
impl Unpin for Date
impl UnwindSafe for Date
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