3 unstable releases
Uses old Rust 2015
0.2.1 | Feb 25, 2021 |
---|---|
0.2.0 | Feb 24, 2021 |
0.1.0 | Feb 23, 2021 |
#2258 in Rust patterns
7KB
63 lines
adrop
Simple and fast dedicated thread drop.
Getting Started
Add the following dependency to your Cargo manifest...
[dependencies]
adrop = "0.2"
Example
extern crate adrop;
use adrop::*;
struct Test {}
impl Drop for Test {
fn drop(&mut self) {
println!(
"Dropping HasDrop! ThreadId: {:?}",
std::thread::current().id()
);
}
}
fn main() {
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 {});
License
- Apache License, Version 2.0, (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)