1
0
mirror of https://github.com/google/comprehensive-rust.git synced 2025-05-18 08:28:38 +02:00

Call out that self receivers are covered later ()

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

@ -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);