use crate::{ Clear, Collection, CollectionMut, CollectionRef, Get, Insert, Iter, Len, Remove, SimpleCollectionMut, SimpleCollectionRef, }; use alloc::collections::BTreeSet; use core::borrow::Borrow; impl Collection for BTreeSet { type Item = T; } impl CollectionRef for BTreeSet { type ItemRef<'a> = &'a T where Self: 'a; crate::covariant_item_ref!(); } impl CollectionMut for BTreeSet { type ItemMut<'a> = &'a mut T where Self: 'a; crate::covariant_item_mut!(); } impl SimpleCollectionRef for BTreeSet { crate::simple_collection_ref!(); } impl SimpleCollectionMut for BTreeSet { crate::simple_collection_mut!(); } impl Len for BTreeSet { #[inline(always)] fn len(&self) -> usize { self.len() } #[inline(always)] fn is_empty(&self) -> bool { self.is_empty() } } impl<'a, Q, T: Ord> Get<&'a Q> for BTreeSet where T: Borrow, Q: Ord + ?Sized, { #[inline(always)] fn get(&self, t: &'a Q) -> Option<&T> { self.get(t) } } impl Insert for BTreeSet { type Output = bool; #[inline(always)] fn insert(&mut self, t: T) -> bool { self.insert(t) } } impl<'a, Q, T: Ord> Remove<&'a Q> for BTreeSet where T: Borrow, Q: Ord + ?Sized, { #[inline(always)] fn remove(&mut self, t: &'a Q) -> Option { self.take(t) } } impl Clear for BTreeSet { #[inline(always)] fn clear(&mut self) { self.clear() } } impl Iter for BTreeSet { type Iter<'a> = alloc::collections::btree_set::Iter<'a, T> where Self: 'a; #[inline(always)] fn iter(&self) -> Self::Iter<'_> { self.iter() } }