From 837343aa51c077b1f2ae22a541493afb3aebd426 Mon Sep 17 00:00:00 2001 From: Greg Burri Date: Thu, 24 Oct 2024 16:16:18 +0200 Subject: [PATCH] Exercise 07-06 --- exercises/07_threads/06_interior_mutability/src/lib.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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; } } -- 2.45.2