vulkan: move OnDrop out of vulkan module
This commit is contained in:
parent
e605940daa
commit
9f98603121
10 changed files with 24 additions and 17 deletions
17
src/utils/on_drop.rs
Normal file
17
src/utils/on_drop.rs
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
use std::mem;
|
||||
|
||||
pub struct OnDrop<F>(pub F)
|
||||
where
|
||||
F: FnMut() + Copy;
|
||||
|
||||
impl<F: FnMut() + Copy> OnDrop<F> {
|
||||
pub fn forget(self) {
|
||||
mem::forget(self);
|
||||
}
|
||||
}
|
||||
|
||||
impl<F: FnMut() + Copy> Drop for OnDrop<F> {
|
||||
fn drop(&mut self) {
|
||||
(self.0)();
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue