fn truncate_to_limit<T: Ord>(set: &mut BTreeSet<T>, limit: Option<usize>)
Drops the last entries of set until it has at most limit, so memory and lookups stay bounded by the limit across all addresses, not just per address.
set
limit