Hard
An inherent &mut self method vs. a trait &self method of the same name
What happens when this program is compiled and run?
main.rs
trait Describe {
fn describe(&self) -> &'static str {
"trait Describe::describe"
}
}
struct Sensor;
impl Sensor {
fn describe(&mut self) -> &'static str {
"inherent Sensor::describe"
}
}
impl Describe for Sensor {}
fn main() {
let mut s = Sensor;
println!("{}", s.describe());
}53 of 53 in Rust