extend_mut

Function extend_mut_async

Source
pub unsafe fn extend_mut_async<'a, 'b, T: 'b, F, Fut, R>(
    mut_ref: &'a mut T,
    f: F,
) -> ExtendMutFuture<'b, T, Fut, R> 
where Fut: Future<Output = (&'b mut T, R)>, F: FnOnce(&'b mut T) -> Fut,
Expand description

Async version of extend_mut. You should not drop the future returned by extend_mut_async until it yields Poll::Ready - if you do, it will abort the process. This function is not cancel-safe.

If polled after yielding Poll::Ready, it will always return Poll::Pending.

§Safety

Shortly - do not cancel returned future.

You must not skip abortion on dropping the future returned by extend_mut_async by any means, including forget, ManuallyDrop etc. Otherwise, borrow checker will allow you to use mut_ref while it might be used by f, which will be undefined behavior.