Crate ctx [] [src]

Structs

WithCancel
WithDeadline
WithValue

Enums

ContextError

Traits

Context

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

Functions

background

Returns an empty Context. It is never canceled has neither a value nor a deadline. It is typically used as a top-level Context.

with_cancel

Returns a copy of parent as a new future, which is closed when the returned cancel function is called or when the parent context's future is resolved – whichever happens first.

with_deadline

Returns with_timeout(parent, deadline - Instant::now()).

with_timeout

Returns a copy of the parent context with the given deadline associated to it. The returned context's future resolves when the deadline expires, the returned cancel function is called, or when the parent context's future resolves – whichever happens first.

with_value

Returns a copy of parent, but with the given value associated to it.