pub fn with_capacity(capacity: usize) -> Self {
        let mut slots = Vec::with_capacity(capacity + 1); // Sentinel.
        slots.push(Slot::new_vacant());
        Self {
            slots,
            num_elems: 0,
            _k: PhantomData,
        }
    }
/// Creates an empty [`SecondaryMap`] with the given capacity of slots.
///
/// The secondary map will not reallocate until it holds at least `capacity`
/// slots. Even inserting a single key-value pair might require as many
/// slots as the slot map the key comes from, so it's recommended to match
/// the capacity of a secondary map to its corresponding slot map.
///
/// # Examples
///
/// ```
/// # use slotmap::*;
/// let mut sm: SlotMap<_, i32> = SlotMap::with_capacity(10);
/// let mut sec: SecondaryMap<DefaultKey, i32> = SecondaryMap::with_capacity(sm.capacity());
/// ```
Creates an empty [`SecondaryMap`] with the given capacity of slots.
The secondary map will not reallocate until it holds at least `capacity`
slots. Even inserting a single key-value pair might require as many
slots as the slot map the key comes from, so it's recommended to match
the capacity of a secondary map to its corresponding slot map.
Creates an empty [ ` SecondaryMap ` ] with the given capacity of slots . The secondary map will not reallocate until it holds at least ` capacity ` slots . Even inserting a single key - value pair might require as many slots as the slot map the key comes from so it ' s recommended to match the capacity of a secondary map to its corresponding slot map .
pub fn with_capacity(capacity: usize) -> Self {
        let mut slots = Vec::with_capacity(capacity + 1); // Sentinel.
        slots.push(Slot::new_vacant());
        Self {
            slots,
            num_elems: 0,
            _k: PhantomData,
        }
    }
pub fn with_capacity ( capacity : usize ) -> Self { let mut slots = Vec :: with_capacity ( capacity + 1 ) ; // Sentinel. slots . push ( Slot :: new_vacant ( ) ) ; Self { slots , num_elems : 0 , _k : PhantomData , } }
Creates an empty [`SecondaryMap`] with the given capacity of slots.
Creates an empty [ ` SecondaryMap ` ] with the given capacity of slots .
capacity
usize
examples
None
use slotmap::*;
let mut sm: SlotMap<_, i32> = SlotMap::with_capacity(10);
let mut sec: SecondaryMap = SecondaryMap::with_capacity(sm.capacity());
```
let mut sm : SlotMap<_ i32 > = SlotMap :: with_capacity ( 10 ) ; let mut sec : SecondaryMap = SecondaryMap :: with_capacity ( sm . capacity () ) ; ` ` `