1
0
Fork 0
forked from wry/wry
wry/src/utils/on_drop_event.rs
2024-09-28 22:29:13 +02:00

18 lines
312 B
Rust

use {crate::utils::asyncevent::AsyncEvent, std::rc::Rc};
#[derive(Default)]
pub struct OnDropEvent {
ae: Rc<AsyncEvent>,
}
impl OnDropEvent {
pub fn event(&self) -> Rc<AsyncEvent> {
self.ae.clone()
}
}
impl Drop for OnDropEvent {
fn drop(&mut self) {
self.ae.trigger()
}
}