Trait tor_checkable::Timebound[][src]

pub trait Timebound<T>: Sized {
    type Error;
    fn is_valid_at(&self, t: &SystemTime) -> Result<(), Self::Error>;
fn dangerously_assume_timely(self) -> T; fn check_valid_at(self, t: &SystemTime) -> Result<T, Self::Error> { ... }
fn check_valid_now(self) -> Result<T, Self::Error> { ... }
fn check_valid_at_opt(self, t: Option<SystemTime>) -> Result<T, Self::Error> { ... } }
Expand description

A Timebound object is one that is only valid for a given range of time.

It’s better to wrap things in a TimeBound than to give them an is_valid() valid method, so that you can make sure that nobody uses the object before checking it.

Associated Types

An error type that’s returned when the object is not timely.

Required methods

Check whether this object is valid at a given time.

Return Ok if the object is valid, and an error if the object is not.

Return the underlying object without checking whether it’s valid.

Provided methods

Unwrap this Timebound object if it is valid at a given time.

Unwrap this Timebound object if it is valid now.

Unwrap this object if it is valid at the provided time t. If no time is provided, check the object at the current time.

Implementors