mirror of
https://github.com/google/comprehensive-rust.git
synced 2025-05-14 22:56:44 +02:00
Call out that self
receivers are covered later (#2422)
We have not formally introduced ownership at this point, so the exercise can be confusing for students. Alternatively, we could consider removing the `finish` method since it’s not essential for a first encounter with methods.
This commit is contained in:
parent
a387b2c755
commit
a1b483a2f5
@ -33,7 +33,7 @@ impl Race {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Exclusive ownership of self
|
// Exclusive ownership of self (covered later)
|
||||||
fn finish(self) {
|
fn finish(self) {
|
||||||
let total: i32 = self.laps.iter().sum();
|
let total: i32 = self.laps.iter().sum();
|
||||||
println!("Race {} is finished, total lap time: {}", self.name, total);
|
println!("Race {} is finished, total lap time: {}", self.name, total);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user