Macro ckb_util::shrink_to_fit
source · macro_rules! shrink_to_fit { ($map:expr, $threshold:expr) => { ... }; }
Expand description
Shrinks the map $map
when it reserves more than $threshold
slots for future entries.
§Examples
use std::collections::HashMap;
use ckb_util::shrink_to_fit;
let mut h = HashMap::<u32, u32>::new();
// Shrink the map when it reserves more than 10 slots for future entries.
shrink_to_fit!(h, 10);