Trait ctx::Context
[−]
[src]
pub trait Context: Future<Item=(), Error=ContextError> { fn deadline(&self) -> Option<Instant> { ... } fn value<T>(&self) -> Option<&T> where T: Any { ... } }
A Context carries a deadline, a cancelation Future, and other values across API boundaries.
Provided Methods
fn deadline(&self) -> Option<Instant>
Returns the time when work done on behalf of this context should be canceled. Successive calls to deadline return the same result.
fn value<T>(&self) -> Option<&T> where T: Any
Returns the value associated with this context for the expected type.
Context values should only be used for request-scoped data that transists processes and API boundaries and not for passing optional parameters to functions.
Implementors
impl<V, C> Context for WithValue<V, C> where C: Context, V: Any
impl<C> Context for WithCancel<C> where C: Context
impl<C> Context for WithDeadline<C> where C: Context