pub struct Lifetime { /* private fields */ }Expand description
Determines the lifetime of a pre-key by defining a time range.
Implementations should reject received messages with expired pre-keys and disallow use.
Implementations§
Source§impl Lifetime
impl Lifetime
Sourcepub fn new(t: u64) -> Self
pub fn new(t: u64) -> Self
Create a new lifetime in seconds from now on.
Note that the lifetime is extended 1h into the past to adapt to skewed clocks, i.e.
not_before is set to now - 1h.
Sourcepub fn verify(&self) -> Result<(), LifetimeError>
pub fn verify(&self) -> Result<(), LifetimeError>
Returns true if this lifetime is valid.
Sourcepub fn verify_with_window(&self, window: Duration) -> Result<(), LifetimeError>
pub fn verify_with_window(&self, window: Duration) -> Result<(), LifetimeError>
Returns true if this lifetime with an additional window is valid.
This method can be used to calculate if a lifetime is about to expire, given a defined time “window”.
[-------]
| |
Lifetime: [---|----] |
| |
now + window
-- t -->Trait Implementations§
Source§impl<'de> Deserialize<'de> for Lifetime
impl<'de> Deserialize<'de> for Lifetime
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
Source§impl Ord for Lifetime
impl Ord for Lifetime
Source§impl PartialOrd for Lifetime
impl PartialOrd for Lifetime
impl Copy for Lifetime
impl Eq for Lifetime
impl StructuralPartialEq for Lifetime
Auto Trait Implementations§
impl Freeze for Lifetime
impl RefUnwindSafe for Lifetime
impl Send for Lifetime
impl Sync for Lifetime
impl Unpin for Lifetime
impl UnwindSafe for Lifetime
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