pub struct LocalTime { /* private fields */ }Expand description
A wall-clock time of day, HH:MM in 24-hour form with leading zeros.
Must be in 24h format with leading zeros. Example: “18:15”. Hour/Minute separator: “:” Regex:
([0-1][0-9]|2[0-3]):[0-5][0-9]
Spec: 2.3.0 §mod_locations_regularhours_class, §mod_tariffs_tariffrestrictions_class
Implementations§
Source§impl LocalTime
impl LocalTime
Sourcepub const MIDNIGHT: Self
pub const MIDNIGHT: Self
Midnight, which the spec also uses to mean “end of day” in TariffRestrictions.end_time.
Sourcepub const fn minutes_since_midnight(self) -> u16
pub const fn minutes_since_midnight(self) -> u16
Minutes since midnight, for comparing and for interval arithmetic.
Sourcepub const fn is_within(self, start: Self, end: Self) -> bool
pub const fn is_within(self, start: Self, end: Self) -> bool
Whether self falls in the half-open interval [start, end), wrapping past midnight.
If
end_time<start_timethen the period wraps around to the next day. To stop at end of the day use: 00:00.
§start == end is the whole day
The specification does not say what start_time == end_time means, and the two readings
are not close: taken as an empty interval the restriction never matches, taken as a
wrap-around it always does. This crate reads it as the whole day, for two reasons.
It is what the wrap-around rule already produces without a special case — the interval
runs from start, past midnight, all the way back round to start — and it is the
reading that fails safe. A TariffElement restricted to 00:00–00:00 that never
matches leaves its dimension with no Price Component, and the specification’s answer to
that is that the dimension is free; a tariff writer who meant “all day” would have
silently given the energy away. The other direction merely charges what the tariff says.
Spec: 2.3.0 §mod_tariffs_tariffrestrictions_class
Trait Implementations§
impl Copy for LocalTime
Source§impl<'de> Deserialize<'de> for LocalTime
impl<'de> Deserialize<'de> for LocalTime
Source§fn deserialize<D: Deserializer<'de>>(d: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(d: D) -> Result<Self, D::Error>
impl Eq for LocalTime
Source§impl JsonSchema for LocalTime
Available on crate feature schema only.
impl JsonSchema for LocalTime
schema only.Source§fn json_schema(_g: &mut SchemaGenerator) -> Schema
fn json_schema(_g: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read moreSource§impl Ord for LocalTime
impl Ord for LocalTime
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialOrd for LocalTime
impl PartialOrd for LocalTime
impl StructuralPartialEq for LocalTime
Auto Trait Implementations§
impl Freeze for LocalTime
impl RefUnwindSafe for LocalTime
impl Send for LocalTime
impl Sync for LocalTime
impl Unpin for LocalTime
impl UnsafeUnpin for LocalTime
impl UnwindSafe for LocalTime
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.