pub trait Collection {
type Item;
// Required method
fn len(&self) -> usize;
// Provided methods
fn is_empty(&self) -> bool { ... }
fn is_nonempty(&self) -> bool { ... }
}Expand description
A trait for collections of items.
Required Associated Types§
Required Methods§
Provided Methods§
Sourcefn is_nonempty(&self) -> bool
fn is_nonempty(&self) -> bool
Checks whether the collection is nonempty.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementations on Foreign Types§
Source§impl<K, V> Collection for BTreeMap<K, V>where
K: Ord,
impl<K, V> Collection for BTreeMap<K, V>where
K: Ord,
Source§impl<K, V> Collection for HashMap<K, V>
Available on crate feature std only.
impl<K, V> Collection for HashMap<K, V>
Available on crate feature
std only.Source§impl<T, const N: usize> Collection for [T; N]
impl<T, const N: usize> Collection for [T; N]
Source§impl<T> Collection for BTreeSet<T>where
T: Ord,
impl<T> Collection for BTreeSet<T>where
T: Ord,
Source§impl<T> Collection for BinaryHeap<T>where
T: Ord,
impl<T> Collection for BinaryHeap<T>where
T: Ord,
Source§impl<T> Collection for HashSet<T>
Available on crate feature std only.
impl<T> Collection for HashSet<T>
Available on crate feature
std only.