Skip to main content

with_deadline

Function with_deadline 

Source
pub fn with_deadline(parent: &Context, deadline: Instant) -> (Context, CancelFn)
Expand description

Return a child context that is automatically cancelled at deadline.

Also returns a CancelFn for early cancellation.

ยงRequirements

Must be called from within a goroutine (under #[go_lib::main]) because it spawns a timer goroutine.