pub struct Date(_);Expand description
Representation of a date in the local time zone.
Implementations
sourceimpl Date
impl Date
sourcepub fn new(year: u32, month: u32, day: u32) -> Result<Self>
pub fn new(year: u32, month: u32, day: u32) -> Result<Self>
Create a Date out of a year, month, and day, returning a Result.
Errors
If one of the parameters is outside the legal range for a date, returns an
Error::InvalidDate.
sourcepub fn parse(datespec: &str) -> Result<Self>
pub fn parse(datespec: &str) -> Result<Self>
Create a Date object from the supplied date specification.
Legal specifications include “today” and “yesterday”, the days of the week “sunday” through “saturday”, and a date in the form “YYYY-MM-DD”. The days of the week result in the date representing the previous instance of that day (last Monday for “monday”, etc.).
Errors
Return Error::InvalidDaySpec if the supplied spec is not valid.
Trait Implementations
sourceimpl Ord for Date
impl Ord for Date
sourceimpl PartialOrd<Date> for Date
impl PartialOrd<Date> for Date
sourcefn partial_cmp(&self, other: &Date) -> Option<Ordering>
fn partial_cmp(&self, other: &Date) -> Option<Ordering>
This method returns an ordering between self and other values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · sourcefn 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 more
sourceimpl TryFrom<&str> for Date
impl TryFrom<&str> for Date
sourcefn try_from(date: &str) -> Result<Self>
fn try_from(date: &str) -> Result<Self>
Create a Date out of a string, returning a Result
Errors
If the date is not formatted as ‘YYYY-MM-DD’, returns an Error::InvalidDate.
Also if the date string cannot be converted into a Date, returns an
Error::InvalidDate.
impl Copy for Date
impl Eq for Date
impl StructuralEq for Date
impl StructuralPartialEq for Date
Auto Trait Implementations
impl RefUnwindSafe for Date
impl Send for Date
impl Sync for Date
impl Unpin for Date
impl UnwindSafe for Date
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more