pub trait Length: Collection {
// Required method
fn len(&self) -> usize;
// Provided methods
fn is_empty(&self) -> bool { ... }
fn is_not_empty(&self) -> bool { ... }
}Required Methods§
Provided Methods§
Sourcefn is_empty(&self) -> bool
fn is_empty(&self) -> bool
True if the container contains 0 elements.
use hexga_core::prelude::*;
assert_eq!([1, 2, 3].is_empty(), false);
let empty_array : [i32; 0] = [];
assert_eq!(empty_array.is_empty(), true);
assert_eq!("".is_empty(), true);
assert_eq!("hello".is_empty(), false);
assert_eq!("".is_empty(), !("".is_not_empty()));Sourcefn is_not_empty(&self) -> bool
fn is_not_empty(&self) -> bool
True if the container contains at least one element.
Will always be different than is_empty().
use hexga_core::prelude::*;
assert_eq!([1, 2, 3].is_not_empty(), true);
let empty_array : [i32; 0] = [];
assert_eq!(empty_array.is_not_empty(), false);
assert_eq!("".is_not_empty(), false);
assert_eq!("hello".is_not_empty(), true);
assert_eq!("".is_empty(), !("".is_not_empty()));Implementations on Foreign Types§
Implementors§
impl<K, Gen, S> Length for GenSetOf<K, Gen, S>
impl<K, V> Length for BTreeMap<K, V>
impl<K, V, Gen, S> Length for GenMapOf<K, V, Gen, S>
impl<K, V, S> Length for HashMap<K, V, S>
Available on crate feature
std only.impl<T> Length for BTreeSet<T>
impl<T> Length for BinaryHeap<T>
impl<T> Length for HslaOf<T>
impl<T> Length for NonEmptyStack<T>
impl<T> Length for RgbaOf<T>
impl<T> Length for VecDeque<T>
impl<T> Length for RectangleOf<T>
impl<T, Gen, C> Length for GenSeq<T, Gen, C>
impl<T, Idx> Length for ImageBaseOf<T, Idx>where
Idx: Integer,
impl<T, Idx, const N: usize> Length for GridOf<T, Idx, N>where
Idx: Integer,
impl<T, S> Length for HashSet<T, S>
Available on crate feature
std only.