pub type TimeRange = TimeRangeBound<()>;Expand description
Validity time range.
We use TimeRangeBound<()> to represent just a validity range.
Aliased Type§
pub struct TimeRange {
obj: (),
start: Option<SystemTime>,
end: Option<SystemTime>,
}Fields§
§obj: ()The underlying object, which we only want to expose if it is currently timely.
start: Option<SystemTime>If present, when the object first became valid.
end: Option<SystemTime>If present, when the object will no longer be valid.
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().