Skip to main content

slotmap_insert

Function slotmap_insert 

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

Insert a new entry into a slotmap using refcounted keys

value_maker should take the provided Count, and incorporate it into a new value.

On return, the entry will be in the map, and there will be one reference, which is returned.

There is no corresponding slotmap_remove in this module. Use Ref::dispose and handle any Garbage it returns.