pub struct Lifetime {
valid_after: SystemTime,
fresh_until: SystemTime,
valid_until: SystemTime,
}
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.
Fields§
§valid_after: SystemTime
Time at which the document becomes valid
fresh_until: SystemTime
Time after which there is expected to be a better version of this consensus
valid_until: SystemTime
Time after which this consensus is expired.
(In practice, Tor clients will keep using documents for a while after this expiration time, if no better one can be found.)
Implementations§
Source§impl 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.
Sourcepub fn voting_period(&self) -> Duration
pub fn voting_period(&self) -> Duration
Return the voting period implied by this lifetime.
(The “voting period” is the amount of time in between when a consensus first becomes valid, and when the next consensus is expected to become valid)
Trait Implementations§
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§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
, which can then be
downcast
into Box<dyn ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
, which can then be further
downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.§impl<T> DowncastSend for T
impl<T> DowncastSend for T
§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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