Introduction
In this lab, we explore the concept of traits in Rust, which are a collection of methods defined for an unknown type called Self
. Traits can be implemented for any data type, allowing the use of methods defined within the trait.
Note: If the lab does not specify a file name, you can use any file name you want. For example, you can use
main.rs
, compile and run it withrustc main.rs && ./main
.