Skip to main content

rebind

Function rebind 

Source
pub async fn rebind<T, Out, Fut, E>(
    slot: &mut Option<T>,
    op: impl FnOnce(T) -> Fut,
) -> Result<Out::Rest, E>
where Out: Threaded<T>, Fut: Future<Output = Result<Out, E>>,
Expand description

Threads the value in slot through a consuming mutation, restoring the returned value and yielding the mutation’s extra outputs.

On error the value stays absent, matching the contract of consuming mutators: the handle is destroyed.

§Panics

Panics when slot is empty.