Traits
Note: this section is still under development, who knows if it’ll exist in the future
Traits are essentially Rust’s version of interfaces.
trait Hello {
fn say_hello(&self) {
}
}
Trait objects
- what can be turned into an object?
- why does having a method without
&self
mean you can’t turn it into an object?
- why does having a method without
- when should or shouldn’t you use boxed trait objects?
Linked references:
- July 30, 2020
Rust / Downcast Trait Object (1)