From: Greg Burri Date: Thu, 24 Oct 2024 14:16:18 +0000 (+0200) Subject: Exercise 07-06 X-Git-Url: http://git.euphorik.ch/index.cgi?a=commitdiff_plain;h=837343aa51c077b1f2ae22a541493afb3aebd426;p=rust_exercises.git Exercise 07-06 --- diff --git a/exercises/07_threads/06_interior_mutability/src/lib.rs b/exercises/07_threads/06_interior_mutability/src/lib.rs index 37d4d4f..311279b 100644 --- a/exercises/07_threads/06_interior_mutability/src/lib.rs +++ b/exercises/07_threads/06_interior_mutability/src/lib.rs @@ -6,18 +6,18 @@ use std::rc::Rc; pub struct DropTracker { value: T, - counter: todo!(), + counter: Rc>, } impl DropTracker { - pub fn new(value: T, counter: todo!()) -> Self { + pub fn new(value: T, counter: Rc>) -> Self { Self { value, counter } } } impl Drop for DropTracker { fn drop(&mut self) { - todo!() + *self.counter.borrow_mut() += 1; } }