Skip to main content

shutdown_within

Function shutdown_within 

pub async fn shutdown_within<W>(
    writer: &mut W,
    scope: &WeakScope,
    grace: Duration,
) -> Result<Result<(), Error>, RunCutoff>
where W: AsyncWrite + Unpin + ?Sized,
Available on crate feature std only.
Expand description

Shut writer down in order, bounded by the hard phase of scope and by grace.

An aborted scope skips the shutdown. A shutdown that is ready on its first poll needs no peer and ends there, with nothing to bound. Otherwise it runs as WeakScope::run_until_aborted_within does, and the RunCutoff that came first is returned when the peer still holds it.