Skip to main content

rebind_entry

Function rebind_entry 

Source
pub async fn rebind_entry<K, V, Out, Fut, E>(
    map: &mut BTreeMap<K, V>,
    key: &K,
    op: impl FnOnce(V) -> Fut,
) -> Result<Out::Rest, E>
where K: Ord, Out: Threaded<V>, Fut: Future<Output = Result<Out, E>>,
Expand description

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

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

§Panics

Panics when key is absent from map.