Trait KeySet

Source
pub trait KeySet<T, K> {
Show 17 methods // Required methods fn new(get_key: GetKeyType<T, K>) -> Self; fn from_intoiter( get_key: GetKeyType<T, K>, iter: impl IntoIterator<Item = T>, ) -> Self; fn insert(&mut self, value: T); fn contains(&self, value: &T) -> bool; fn remove(&mut self, value: &T) -> bool; fn take(&mut self, value: &T) -> Option<T>; fn get(&mut self, value: &T) -> Option<&T>; fn len(&self) -> usize; fn iter(&self) -> IntoIter<&T>; fn intersection<'a>(&'a self, other: &'a Self) -> Self; fn union<'a>(&'a self, other: &'a Self) -> Self; fn difference<'a>(&'a self, other: &'a Self) -> Self; fn symmetric_difference<'a>(&'a self, other: &'a Self) -> Self; // Provided methods fn is_subset(&self, other: &Self) -> bool { ... } fn is_superset(&self, other: &Self) -> bool { ... } fn is_empty(&self) -> bool { ... } fn is_disjoint(&self, other: &Self) -> bool { ... }
}
Expand description

KeySet

Required Methods§

Source

fn new(get_key: GetKeyType<T, K>) -> Self

Create KeySet

Source

fn from_intoiter( get_key: GetKeyType<T, K>, iter: impl IntoIterator<Item = T>, ) -> Self

Source

fn insert(&mut self, value: T)

Operate KeySet elem

Source

fn contains(&self, value: &T) -> bool

Source

fn remove(&mut self, value: &T) -> bool

Source

fn take(&mut self, value: &T) -> Option<T>

Source

fn get(&mut self, value: &T) -> Option<&T>

Source

fn len(&self) -> usize

Source

fn iter(&self) -> IntoIter<&T>

Source

fn intersection<'a>(&'a self, other: &'a Self) -> Self

Operate with other KeySet

Source

fn union<'a>(&'a self, other: &'a Self) -> Self

Source

fn difference<'a>(&'a self, other: &'a Self) -> Self

Source

fn symmetric_difference<'a>(&'a self, other: &'a Self) -> Self

Provided Methods§

Source

fn is_subset(&self, other: &Self) -> bool

Check KeySet relationship

Source

fn is_superset(&self, other: &Self) -> bool

Source

fn is_empty(&self) -> bool

Source

fn is_disjoint(&self, other: &Self) -> bool

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<T, K> KeySet<T, K> for KeyHashSet<T, K>
where T: Clone, K: Eq + Hash,