complete threads till 06

This commit is contained in:
2025-04-15 16:25:01 +05:30
parent 9bc063a05b
commit 4fbee2d894
9 changed files with 67 additions and 19 deletions

View File

@@ -6,18 +6,18 @@ use std::rc::Rc;
pub struct DropTracker<T> {
value: T,
counter: todo!(),
counter: Rc<RefCell<usize>>,
}
impl<T> DropTracker<T> {
pub fn new(value: T, counter: todo!()) -> Self {
pub fn new(value: T, counter: Rc<RefCell<usize>>) -> Self {
Self { value, counter }
}
}
impl<T> Drop for DropTracker<T> {
fn drop(&mut self) {
todo!()
*self.counter.borrow_mut() += 1;
}
}