mirror of
https://github.com/natsukagami/youmubot.git
synced 2025-04-19 08:48:54 +00:00
Write db on WriteGuard drop
This commit is contained in:
parent
ed8346abb9
commit
581b039032
1 changed files with 11 additions and 0 deletions
|
@ -64,3 +64,14 @@ where
|
||||||
(*self).0.borrow_data_mut()
|
(*self).0.borrow_data_mut()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl<T> Drop for DBWriteGuard<T>
|
||||||
|
where
|
||||||
|
T: Send + Sync + Clone + std::fmt::Debug + Serialize + DeserializeOwned,
|
||||||
|
{
|
||||||
|
fn drop(&mut self) {
|
||||||
|
if let Err(e) = self.0.save() {
|
||||||
|
dbg!(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue