diff --git a/youmubot-db/src/lib.rs b/youmubot-db/src/lib.rs index ccf8576..974fc60 100644 --- a/youmubot-db/src/lib.rs +++ b/youmubot-db/src/lib.rs @@ -64,3 +64,14 @@ where (*self).0.borrow_data_mut() } } + +impl Drop for DBWriteGuard +where + T: Send + Sync + Clone + std::fmt::Debug + Serialize + DeserializeOwned, +{ + fn drop(&mut self) { + if let Err(e) = self.0.save() { + dbg!(e); + } + } +}