INNER CODE UNIT · Rust

new

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

    pub fn new<T: Send + 'static>(value: T) -> Self {
        let handle = thread::spawn(move || {
            drop(value);
        });
        Self { handle: Some(handle) }
    }
}

impl Drop for AsyncDrop {
    fn drop(&mut self) {
        if let Some(handle) = self.handle.take() {
            handle.join().ok();
        }
    }
}

// ---

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…