mirror of
https://github.com/natsukagami/youmubot.git
synced 2025-04-19 08:48:54 +00:00
DB: WriteGuard methods take any lifetime
This commit is contained in:
parent
ff2626b656
commit
9ea038157d
1 changed files with 2 additions and 2 deletions
|
@ -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()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue