Function slotmap_try_insert

Source
pub(crate) fn slotmap_try_insert<K: Key, V, E, RD>(
    slotmap: &mut SlotMap<K, V>,
    value_maker: impl FnOnce(Count<K>) -> Result<(V, RD), E>,
) -> Result<(Ref<K>, RD), E>
Expand description

Insert a new entry into a slotmap using refcounted keys, fallibly and with extra data

Like slotmap_insert but:

  • value_maker can also return extra return data RD to the caller
  • value_maker is allowed to fail.

On successful return, the entry will be in the map, and the new Ref is returned along with the data D.