pub fn fuse<F>(future: F) -> Fuse<F> ⓘ
Expand description
Fuse a future such that poll
will never again be called once it has
completed. This method can be used to turn any Future
into a
FusedFuture
.
Normally, once a future has returned Poll::Ready
from poll
,
any further calls could exhibit bad behavior such as blocking
forever, panicking, never returning, etc. If it is known that poll
may be called too often then this method can be used to ensure that it
has defined semantics.
If a fuse
d future is poll
ed after having returned Poll::Ready
previously, it will return Poll::Pending
, from poll
again (and will
continue to do so for all future calls to poll
).
This combinator will drop the underlying future as soon as it has been completed to ensure resources are reclaimed as soon as possible.