Trait InnerContext

Source
pub trait InnerContext: Future<Item = (), Error = ContextError> {
    // Provided methods
    fn deadline(&self) -> Option<Instant> { ... }
    fn value(&self) -> Option<&dyn Any> { ... }
    fn parent(&self) -> Option<Context> { ... }
}
Expand description

A Context carries a deadline, a cancelation Future, and other values across API boundaries.

Provided Methods§

Source

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.

Source

fn value(&self) -> Option<&dyn 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.

Source

fn parent(&self) -> Option<Context>

Implementors§