pub struct FreshWindow { /* private fields */ }Expand description
The validity interval attached to one observation.
Implementations§
Source§impl FreshWindow
impl FreshWindow
Sourcepub fn new(
observed_at: UnixMillis,
expires_at: UnixMillis,
) -> Result<FreshWindow, TimeError>
pub fn new( observed_at: UnixMillis, expires_at: UnixMillis, ) -> Result<FreshWindow, TimeError>
Builds a validity window after checking temporal ordering.
§Errors
Returns TimeError::InvertedWindow when expiry precedes observation.
Sourcepub fn for_duration(
observed_at: UnixMillis,
duration: DurationMillis,
) -> Result<FreshWindow, TimeError>
pub fn for_duration( observed_at: UnixMillis, duration: DurationMillis, ) -> Result<FreshWindow, TimeError>
Builds a validity window from an observation time and duration.
§Errors
Returns TimeError::Overflow if expiry is not representable.
pub const fn observed_at(self) -> UnixMillis
pub const fn expires_at(self) -> UnixMillis
Sourcepub const fn state_at(self, now: UnixMillis) -> TemporalState
pub const fn state_at(self, now: UnixMillis) -> TemporalState
The interval is inclusive at both boundaries.
Trait Implementations§
Source§impl Clone for FreshWindow
impl Clone for FreshWindow
Source§fn clone(&self) -> FreshWindow
fn clone(&self) -> FreshWindow
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for FreshWindow
Source§impl Debug for FreshWindow
impl Debug for FreshWindow
Source§impl<'de> Deserialize<'de> for FreshWindow
impl<'de> Deserialize<'de> for FreshWindow
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<FreshWindow, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<FreshWindow, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for FreshWindow
Source§impl PartialEq for FreshWindow
impl PartialEq for FreshWindow
Source§impl Serialize for FreshWindow
impl Serialize for FreshWindow
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl StructuralPartialEq for FreshWindow
Auto Trait Implementations§
impl Freeze for FreshWindow
impl RefUnwindSafe for FreshWindow
impl Send for FreshWindow
impl Sync for FreshWindow
impl Unpin for FreshWindow
impl UnsafeUnpin for FreshWindow
impl UnwindSafe for FreshWindow
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