pub struct TimeRange {
pub start: Option<Instant>,
pub end: Option<Instant>,
}Expand description
A Julian-day interval.
Fields§
§start: Option<Instant>Inclusive lower bound.
end: Option<Instant>Inclusive upper bound.
Implementations§
Source§impl TimeRange
impl TimeRange
Sourcepub const fn new(start: Option<Instant>, end: Option<Instant>) -> Self
pub const fn new(start: Option<Instant>, end: Option<Instant>) -> Self
Creates a new time range.
Sourcepub fn contains(&self, instant: Instant) -> bool
pub fn contains(&self, instant: Instant) -> bool
Returns true if the given instant is inside the range.
Containment requires the instant to share each present bound’s
TimeScale: an instant tagged with a different time
scale than a present bound, or one carrying a non-finite Julian day, is
treated as not contained. An unbounded side imposes no constraint.
Sourcepub fn validate(self) -> Result<(), TimeRangeValidationError>
pub fn validate(self) -> Result<(), TimeRangeValidationError>
Validates the range bounds and ordering.
Unbounded ranges are valid. When one or both bounds are present, the finite Julian-day requirement applies to each bound, the two bounds must use the same time scale, and the upper bound must not precede the lower bound.
Sourcepub fn summary_line(&self) -> String
pub fn summary_line(&self) -> String
Returns a compact one-line rendering of the range.
Trait Implementations§
impl Copy for TimeRange
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 StructuralPartialEq 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 UnsafeUnpin 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