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§
Sourcefn deadline(&self) -> Option<Instant>
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.
Sourcefn value(&self) -> Option<&dyn Any>
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.