pub struct Lifetime { /* private fields */ }
Expand description
The lifetime of a networkstatus document.
In a consensus, this type describes when the consensus may safely be used. In a vote, this type describes the proposed lifetime for a consensus.
Implementations
sourceimpl Lifetime
impl Lifetime
sourcepub fn new(
valid_after: SystemTime,
fresh_until: SystemTime,
valid_until: SystemTime
) -> Result<Self>
pub fn new(
valid_after: SystemTime,
fresh_until: SystemTime,
valid_until: SystemTime
) -> Result<Self>
Construct a new Lifetime.
sourcepub fn valid_after(&self) -> SystemTime
pub fn valid_after(&self) -> SystemTime
Return time when this consensus first becomes valid.
(You might see a consensus a little while before this time, since voting tries to finish up before the.)
sourcepub fn fresh_until(&self) -> SystemTime
pub fn fresh_until(&self) -> SystemTime
Return time when this consensus is no longer fresh.
You can use the consensus after this time, but there is (or is supposed to be) a better one by this point.
sourcepub fn valid_until(&self) -> SystemTime
pub fn valid_until(&self) -> SystemTime
Return the time when this consensus is no longer valid.
You should try to get a better consensus after this time, though it’s okay to keep using this one if no more recent one can be found.
sourcepub fn valid_at(&self, when: SystemTime) -> bool
pub fn valid_at(&self, when: SystemTime) -> bool
Return true if this consensus is officially valid at the provided time.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Lifetime
impl Send for Lifetime
impl Sync for Lifetime
impl Unpin for Lifetime
impl UnwindSafe for Lifetime
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more