mirror of
https://github.com/rust-lang/rust.git
synced 2025-05-14 02:49:40 +00:00
Add OnDrop
This commit is contained in:
parent
8e5eb025a2
commit
37f9c7ff82
@ -76,6 +76,14 @@ pub mod flock;
|
||||
pub mod sync;
|
||||
pub mod owning_ref;
|
||||
|
||||
pub struct OnDrop<F: Fn()>(pub F);
|
||||
|
||||
impl<F: Fn()> Drop for OnDrop<F> {
|
||||
fn drop(&mut self) {
|
||||
(self.0)();
|
||||
}
|
||||
}
|
||||
|
||||
// See comments in src/librustc/lib.rs
|
||||
#[doc(hidden)]
|
||||
pub fn __noop_fix_for_27438() {}
|
||||
|
Loading…
Reference in New Issue
Block a user