pub trait Collection {
type Item;
// Required method
fn size(&self) -> usize;
// Provided method
fn is_empty(&self) -> bool { ... }
}Expand description
trait to impl for any type that represents a collection of items
pub trait Collection {
type Item;
// Required method
fn size(&self) -> usize;
// Provided method
fn is_empty(&self) -> bool { ... }
}trait to impl for any type that represents a collection of items