Trait (Rust)

A trait defines a set of methods that a type can implement — Rust's version of an interface. Traits enable shared behavior and are the foundation of Rust's…