INNER CODE UNIT · Rust

async_drop_drops_value_in_background

pamburus/hl · crates/lifecycle/src/lib.rs:124

    fn async_drop_drops_value_in_background() {
        let dropped = Arc::new(Mutex::new(false));
        let dropped_clone = Arc::clone(&dropped);

        struct TestDrop {
            dropped: Arc<Mutex<bool>>,
        }

        impl Drop for TestDrop {
            fn drop(&mut self) {
                *self.dropped.lock().unwrap() = true;
            }
        }

        {
            let test_drop = TestDrop { dropped: dropped_clone };
            let _async_drop = AsyncDrop::new(test_drop);
        }

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…