Skip to main content

TimeRange

Type Alias TimeRange 

Source
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

Source

pub fn new_range<U>(range: U) -> Self

Create a new TimeRange from a std::ops::RangeBounds

Source

pub fn apply_to<T>(self, t: T) -> TimeRangeBound<T>

Applies this TimeRange to a value, protecting it

Source

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().

Source

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<RangeFrom<SystemTime>> for TimeRange

Source§

fn from(r: RangeFrom<SystemTime>) -> TimeRange

Converts to this type from the input type.
Source§

impl From<RangeFull> for TimeRange

Source§

fn from(r: RangeFull) -> TimeRange

Converts to this type from the input type.
Source§

impl From<RangeInclusive<SystemTime>> for TimeRange

Source§

fn from(r: RangeInclusive<SystemTime>) -> TimeRange

Converts to this type from the input type.
Source§

impl From<RangeToInclusive<SystemTime>> for TimeRange

Source§

fn from(r: RangeToInclusive<SystemTime>) -> TimeRange

Converts to this type from the input type.