pub struct OcppDate { /* private fields */ }Expand description
A local calendar date, YYYY-MM-DD.
The companion to OcppTimeOfDay: 2.1’s validFromDate/validToDate
state this format in prose and leave the property unbounded.
Four bytes, and chronologically ordered by the derive since the fields run most-significant first.
Implementations§
Source§impl OcppDate
impl OcppDate
Sourcepub const fn new(year: u16, month: u8, day: u8) -> Result<Self, TimestampError>
pub const fn new(year: u16, month: u8, day: u8) -> Result<Self, TimestampError>
Builds a date, rejecting a month outside 1..=12 or a day the month doesn’t have – including 29 February in a common year.
pub const fn year(&self) -> u16
pub const fn month(&self) -> u8
pub const fn day(&self) -> u8
Sourcepub const fn days_from_epoch(&self) -> i64
pub const fn days_from_epoch(&self) -> i64
Days since the Unix epoch, for arithmetic against other dates.
Sourcepub fn parse(text: &str) -> Result<Self, TimestampError>
pub fn parse(text: &str) -> Result<Self, TimestampError>
Parses YYYY-MM-DD, as the specification’s own regex describes.
Trait Implementations§
impl Copy for OcppDate
Source§impl<'de> Deserialize<'de> for OcppDate
Available on crate feature serde only.
impl<'de> Deserialize<'de> for OcppDate
Available on crate feature
serde only.Source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
Deserialize this value from the given Serde deserializer. Read more
impl Eq for OcppDate
Source§impl Ord for OcppDate
impl Ord for OcppDate
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 OcppDate
impl PartialOrd for OcppDate
impl StructuralPartialEq for OcppDate
Auto Trait Implementations§
impl Freeze for OcppDate
impl RefUnwindSafe for OcppDate
impl Send for OcppDate
impl Sync for OcppDate
impl Unpin for OcppDate
impl UnsafeUnpin for OcppDate
impl UnwindSafe for OcppDate
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