This will be used for serde attributes that are copied to incoming types and thus actually have to function for multiple types.
10 lines
204 B
Rust
10 lines
204 B
Rust
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()
|
|
}
|