pub struct OcppTimeOfDay { /* private fields */ }Expand description
A local time of day, HH:MM.
2.1’s tariff conditions carry startTimeOfDay/endTimeOfDay, whose
property descriptions state the format (and its regex) while the schema
itself declares no maxLength – so as strings they took the generator’s
unbounded default.
Two bytes: an hour and a minute. One would not do, since a minute resolution has 1,440 distinct values and a byte holds 256.
Ordering is chronological within the day, which is what the derive gives: the fields are declared most-significant first.
Implementations§
Source§impl OcppTimeOfDay
impl OcppTimeOfDay
Sourcepub const fn new(hour: u8, minute: u8) -> Result<Self, TimestampError>
pub const fn new(hour: u8, minute: u8) -> Result<Self, TimestampError>
Builds a time of day, rejecting an hour past 23 or a minute past 59.
pub const fn hour(&self) -> u8
pub const fn minute(&self) -> u8
Sourcepub const fn minutes_since_midnight(&self) -> u16
pub const fn minutes_since_midnight(&self) -> u16
Minutes since midnight, for arithmetic against a window.
Sourcepub fn parse(text: &str) -> Result<Self, TimestampError>
pub fn parse(text: &str) -> Result<Self, TimestampError>
Parses HH:MM, as the specification’s own regex describes. Leading
zeros are required, matching that regex.
Trait Implementations§
Source§impl Clone for OcppTimeOfDay
impl Clone for OcppTimeOfDay
Source§fn clone(&self) -> OcppTimeOfDay
fn clone(&self) -> OcppTimeOfDay
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for OcppTimeOfDay
Source§impl Debug for OcppTimeOfDay
impl Debug for OcppTimeOfDay
Source§impl<'de> Deserialize<'de> for OcppTimeOfDay
Available on crate feature serde only.
impl<'de> Deserialize<'de> for OcppTimeOfDay
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
Source§impl Display for OcppTimeOfDay
impl Display for OcppTimeOfDay
impl Eq for OcppTimeOfDay
Source§impl FromStr for OcppTimeOfDay
impl FromStr for OcppTimeOfDay
Source§impl Hash for OcppTimeOfDay
impl Hash for OcppTimeOfDay
Source§impl Ord for OcppTimeOfDay
impl Ord for OcppTimeOfDay
Source§fn cmp(&self, other: &OcppTimeOfDay) -> Ordering
fn cmp(&self, other: &OcppTimeOfDay) -> Ordering
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 PartialEq for OcppTimeOfDay
impl PartialEq for OcppTimeOfDay
Source§impl PartialOrd for OcppTimeOfDay
impl PartialOrd for OcppTimeOfDay
Source§impl Serialize for OcppTimeOfDay
Available on crate feature serde only.
impl Serialize for OcppTimeOfDay
Available on crate feature
serde only.impl StructuralPartialEq for OcppTimeOfDay
Auto Trait Implementations§
impl Freeze for OcppTimeOfDay
impl RefUnwindSafe for OcppTimeOfDay
impl Send for OcppTimeOfDay
impl Sync for OcppTimeOfDay
impl Unpin for OcppTimeOfDay
impl UnsafeUnpin for OcppTimeOfDay
impl UnwindSafe for OcppTimeOfDay
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