pub type TimeRange = TimeRangeBound<()>;Expand description
Validity time range.
We use TimeRangeBound<()> to represent just a validity range.
Aliased Type§
pub struct TimeRange { /* private fields */ }Implementations§
Source§impl TimeRange
impl TimeRange
Sourcepub fn new_range<U>(range: U) -> Selfwhere
U: RangeBounds<SystemTime>,
pub fn new_range<U>(range: U) -> Selfwhere
U: RangeBounds<SystemTime>,
Create a new TimeRange from a std::ops::RangeBounds
Sourcepub fn apply_to<T>(self, t: T) -> TimeRangeBound<T>
pub fn apply_to<T>(self, t: T) -> TimeRangeBound<T>
Applies this TimeRange to a value, protecting it
Sourcepub fn start(&self) -> Option<SystemTime>
pub fn start(&self) -> Option<SystemTime>
Get the start of the validity period
None means there is no start: the object has been valid forever.
Provided only for TimeRange; to call on a general TimeRangeBound<T>,
write .bounds().start().
Sourcepub fn end(&self) -> Option<SystemTime>
pub fn end(&self) -> Option<SystemTime>
Get the end of the validity period
None means there is no end: the object will been valid forever.
This is normally a mistake.
Provided only for TimeRange; to call on a general TimeRangeBound<T>,
write .bounds().end().
Trait Implementations§
Source§impl From<RangeInclusive<SystemTime>> for TimeRange
impl From<RangeInclusive<SystemTime>> for TimeRange
Source§fn from(r: RangeInclusive<SystemTime>) -> TimeRange
fn from(r: RangeInclusive<SystemTime>) -> TimeRange
Converts to this type from the input type.
Source§impl From<RangeToInclusive<SystemTime>> for TimeRange
impl From<RangeToInclusive<SystemTime>> for TimeRange
Source§fn from(r: RangeToInclusive<SystemTime>) -> TimeRange
fn from(r: RangeToInclusive<SystemTime>) -> TimeRange
Converts to this type from the input type.