pub struct Epoch {
seqnr: u64,
}Expand description
Represents a Yivi epoch by its sequence number. The 0th epoch starts at 1970-01-01T00:00:00Z
and each epoch lasts exactly $60 \cdot 60 \cdot 24 \cdot 7$ seconds (= 1 week).
Fields§
§seqnr: u64Implementations§
Source§impl Epoch
impl Epoch
Sourceconst MAX_SEQNR: u64
const MAX_SEQNR: u64
Largest valid sequence number: beyond it an epoch’s start falls outside the representable
NumericDate range. From<NumericDate> never produces a larger one.
The last valid epoch contains the maximal instant, so its end is unrepresentable and
ends saturates there.
Sourcepub fn with_seqnr(seqnr: u64) -> Result<Self, OutOfRange>
pub fn with_seqnr(seqnr: u64) -> Result<Self, OutOfRange>
Returns the Yivi epoch with the given sequence number, or jwt::OutOfRange when it is so
large that the epoch would fall outside the representable NumericDate
range.
Sourcepub fn starts(&self) -> NumericDate
pub fn starts(&self) -> NumericDate
Returns the second this epoch starts
Sourcepub fn ends(&self) -> NumericDate
pub fn ends(&self) -> NumericDate
Returns the first second of the next epoch.
For the last representable epoch — whose successor would start after year 9999, never a real, present-day epoch — this saturates to the maximal representable instant rather than going out of range.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Epoch
impl<'de> Deserialize<'de> for Epoch
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>,
Source§impl From<NumericDate> for Epoch
impl From<NumericDate> for Epoch
Source§fn from(nd: NumericDate) -> Self
fn from(nd: NumericDate) -> Self
Source§impl Ord for Epoch
impl Ord for Epoch
Source§impl PartialOrd for Epoch
impl PartialOrd for Epoch
impl Copy for Epoch
impl Eq for Epoch
impl StructuralPartialEq for Epoch
Auto Trait Implementations§
impl Freeze for Epoch
impl RefUnwindSafe for Epoch
impl Send for Epoch
impl Sync for Epoch
impl Unpin for Epoch
impl UnsafeUnpin for Epoch
impl UnwindSafe for Epoch
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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>
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>
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