pub fn or_insert_with_key<F>(self, default: F) -> &'a mut V
    where
        F: FnOnce(&K) -> V,
    {
        match self.vacant_key {
            None => self.inner.into_val_mut(),
            Some(key) => unsafe {
                let value = default(&key);
                Self::force_insert(self.inner, self.self_ptr, key, value)
            },
        }
    }
/// Ensures a value is present in the entry by inserting the result of the default function
/// if not, and returns a mutable reference to the value.
///
/// The function is parameterized by a reference to the key of the entry and thus allows
/// key-derived value generation.
///
/// # Examples
///
/// ```
/// use bptree::BpTreeMap;
///
/// let mut map = BpTreeMap::new();
/// map.entry("Hello").or_insert_with_key(|key| key.chars().count());
/// assert_eq!(map["Hello"], 5);
/// ```
Ensures a value is present in the entry by inserting the result of the default function
if not, and returns a mutable reference to the value.

The function is parameterized by a reference to the key of the entry and thus allows
key-derived value generation.
Ensures a value is present in the entry by inserting the result of the default function if not and returns a mutable reference to the value . The function is parameterized by a reference to the key of the entry and thus allows key - derived value generation .
pub fn or_insert_with_key<F>(self, default: F) -> &'a mut V
    where
        F: FnOnce(&K) -> V,
    {
        match self.vacant_key {
            None => self.inner.into_val_mut(),
            Some(key) => unsafe {
                let value = default(&key);
                Self::force_insert(self.inner, self.self_ptr, key, value)
            },
        }
    }
pub fn or_insert_with_key < F > ( self , default : F ) -> & ' a mut V where F : FnOnce ( & K ) -> V , { match self . vacant_key { None => self . inner . into_val_mut ( ) , Some ( key ) => unsafe { let value = default ( & key ) ; Self :: force_insert ( self . inner , self . self_ptr , key , value ) } , } }
Ensures a value is present in the entry by inserting the result of the default function
if not, and returns a mutable reference to the value.
Ensures a value is present in the entry by inserting the result of the default function if not and returns a mutable reference to the value .
self
default
F
self
default
F
examples
```
use bptree::BpTreeMap.

let mut map = BpTreeMap::new();
map.entry("Hello").or_insert_with_key(|key| key.chars().count());
assert_eq!(map["Hello"], 5);
```
` ` ` use bptree :: BpTreeMap . let mut map = BpTreeMap :: new () ; map . entry ( " Hello " ) . or_insert_with_key ( |key| key . chars () . count () ) ; assert_eq! ( map [ " Hello " ] 5 ) ; ` ` `