pub struct TimeRange {
pub start: Option<DateTime<Utc>>,
pub end: Option<DateTime<Utc>>,
}
Expand description
A range of time.
The time range should be applicable between the start time, inclusive, and end time, exclusive. There aren’t any explicit checks to ensure the end time is equal to or greater than the start time; the time range isn’t valid in such cases.
Fields§
§start: Option<DateTime<Utc>>
The inclusive start of the time range.
end: Option<DateTime<Utc>>
The exclusive end of the time range.
Implementations§
source§impl TimeRange
impl TimeRange
sourcepub fn contains(&self, time: DateTime<Utc>) -> bool
pub fn contains(&self, time: DateTime<Utc>) -> bool
Returns whether the provided time matches the time range.
For a time to match a time range, the following conditions must match:
- The start time must be smaller than or equal to the given time, if provided.
- The end time must be greater than the given time, if provided.
If one of the limits isn’t provided, the range is considered open in that limit. A time range open on both sides matches with any given time.
Trait Implementations§
source§impl<'de> Deserialize<'de> for TimeRange
impl<'de> Deserialize<'de> for TimeRange
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Copy for TimeRange
Auto Trait Implementations§
impl Freeze for TimeRange
impl RefUnwindSafe for TimeRange
impl Send for TimeRange
impl Sync for TimeRange
impl Unpin for TimeRange
impl UnwindSafe for TimeRange
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more