1
0
mirror of https://github.com/google/comprehensive-rust.git synced 2024-11-21 13:25:53 +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:
Martin Geisler 2024-10-15 16:15:12 +02:00 committed by GitHub
parent a387b2c755
commit a1b483a2f5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -33,7 +33,7 @@ impl Race {
}
}
// Exclusive ownership of self
// Exclusive ownership of self (covered later)
fn finish(self) {
let total: i32 = self.laps.iter().sum();
println!("Race {} is finished, total lap time: {}", self.name, total);