Expand description
Simple and fast dedicated thread drop.
§Example
use adrop::*;
struct Test {}
impl Drop for Test {
fn drop(&mut self) {
println!(
"Dropping HasDrop! ThreadId: {:?}",
std::thread::current().id()
);
}
}
println!("Main ThreadId: {:?}", std::thread::current().id());
adrop(Test {});
// Output:
// Main ThreadId: ThreadId(1)
// Dropping HasDrop! ThreadId: ThreadId(2)
// Or you can use `Adrop` wrapper to realize automatic `adrop`:
let _ = Adrop::new(Test {});
Structs§
- Adrop
Adrop
wrapper can realize automaticadrop
.
Functions§
- adrop
- Pass the value to a dedicated thread for destruction.