pub struct AsyncSendTry<'a, G: AsyncSendTryGetFut<'a>> { /* private fields */ }Expand description
Try to encapsulate an async-constructed borrowed-future along with it’s owner.
This struct only works with Send futures. If you’re working with !Send-futures,
try using AsyncTry.
This struct can be constructed by passing to Self::new the owner by value and a
functor-like AsyncSendTryGetFut, which when invoked will return a borrowed-future.’
In contrast to the method helpers in this crate, this structure is a future which must
be polled in order to acquire the owned-future. Polling this future will first poll the
functor until it results in either an error, in which case this future will yield that
same error along with the owner, or a borrowed-future, in which ase this future will
yield a future which has taken ownership of the owner, and will .await the borrowed
future when polled. Auxiliary data returned by the functor is also yielded in this case.
Callers may wish to use crate::async_send_try_get to quickly construct the functor
for cases which don’t require capturing, but any type which implements AsyncTryGetFut
will work.