1
0
Fork 0
forked from wry/wry

vulkan: move OnDrop out of vulkan module

This commit is contained in:
Julian Orth 2024-09-07 12:48:02 +02:00
parent e605940daa
commit 9f98603121
10 changed files with 24 additions and 17 deletions

17
src/utils/on_drop.rs Normal file
View 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)();
}
}