1
2
3
4
5
6
7
8
9
pub trait CanBeEmpty {
    /// Check whether `self` is empty.
    fn is_empty(&self) -> bool;
}

/// Check whether a value is empty.
pub fn is_empty<T: CanBeEmpty>(val: &T) -> bool {
    val.is_empty()
}