DB: WriteGuard methods take any lifetime

This commit is contained in:
Natsu Kagami 2020-09-03 18:05:36 -04:00
parent ff2626b656
commit 9ea038157d
Signed by: nki
GPG key ID: 73376E117CD20735

View file

@ -64,11 +64,11 @@ where
T: Send + Sync + Clone + std::fmt::Debug + Serialize + DeserializeOwned, T: Send + Sync + Clone + std::fmt::Debug + Serialize + DeserializeOwned,
{ {
/// Borrows the FileDatabase. /// Borrows the FileDatabase.
pub fn borrow(&'a self) -> Result<std::sync::RwLockReadGuard<T>, DBError> { pub fn borrow(&self) -> Result<std::sync::RwLockReadGuard<T>, DBError> {
self.db.borrow_data() self.db.borrow_data()
} }
/// Borrows the FileDatabase for writing. /// Borrows the FileDatabase for writing.
pub fn borrow_mut(&'a mut self) -> Result<std::sync::RwLockWriteGuard<T>, DBError> { pub fn borrow_mut(&mut self) -> Result<std::sync::RwLockWriteGuard<T>, DBError> {
self.needs_save = true; self.needs_save = true;
self.db.borrow_data_mut() self.db.borrow_data_mut()
} }