pub fn with_capacity_and_key(capacity: usize) -> Self {
        // Create slots with a sentinel at index 0.
        // We don't actually use the sentinel for anything currently, but
        // HopSlotMap does, and if we want keys to remain valid through
        // conversion we have to have one as well.
        let mut slots = Vec::with_capacity(capacity + 1);
        slots.push(Slot {
            u: SlotUnion { next_free: 0 },
            version: 0,
        });

        Self {
            slots,
            free_head: 1,
            num_elems: 0,
            _k: PhantomData,
        }
    }
/// Creates an empty [`SlotMap`] with the given capacity and a custom key
/// type.
///
/// The slot map will not reallocate until it holds at least `capacity`
/// elements.
///
/// # Examples
///
/// ```
/// # use slotmap::*;
/// new_key_type! {
///     struct MessageKey;
/// }
/// let mut messages = SlotMap::with_capacity_and_key(3);
/// let welcome: MessageKey = messages.insert("Welcome");
/// let good_day = messages.insert("Good day");
/// let hello = messages.insert("Hello");
/// ```
Creates an empty [`SlotMap`] with the given capacity and a custom key
type.

The slot map will not reallocate until it holds at least `capacity`
elements.
Creates an empty [ ` SlotMap ` ] with the given capacity and a custom key type . The slot map will not reallocate until it holds at least ` capacity ` elements .
pub fn with_capacity_and_key(capacity: usize) -> Self {
        // Create slots with a sentinel at index 0.
        // We don't actually use the sentinel for anything currently, but
        // HopSlotMap does, and if we want keys to remain valid through
        // conversion we have to have one as well.
        let mut slots = Vec::with_capacity(capacity + 1);
        slots.push(Slot {
            u: SlotUnion { next_free: 0 },
            version: 0,
        });
        Self {
            slots,
            free_head: 1,
            num_elems: 0,
            _k: PhantomData,
        }
    }
pub fn with_capacity_and_key ( capacity : usize ) -> Self { // Create slots with a sentinel at index 0. // We don't actually use the sentinel for anything currently, but // HopSlotMap does, and if we want keys to remain valid through // conversion we have to have one as well. let mut slots = Vec :: with_capacity ( capacity + 1 ) ; slots . push ( Slot { u : SlotUnion { next_free : 0 } , version : 0 , } ) ; Self { slots , free_head : 1 , num_elems : 0 , _k : PhantomData , } }
Creates an empty [`SlotMap`] with the given capacity and a custom key
type.
Creates an empty [ ` SlotMap ` ] with the given capacity and a custom key type .
capacity
usize
examples
None
use slotmap::*;
None