Don't update value in destructor
@@ -208,6 +208,8 @@ where
pub fn set(&mut self, state: V) {
let mut cache = self.cache.get_mut();
cache.state = state;
+ View::new(self.index_access, IndexAddress::from(INDEXES_POOL_NAME))
+ .put(&self.index_name, *cache);
}
}
@@ -221,17 +223,6 @@ where
}
}
-impl<T, V> Drop for IndexState<T, V>
-where
- V: BinaryValue + Serialize + DeserializeOwned + Default + Copy,
- T: IndexAccess,
-{
- fn drop(&mut self) {
- View::new(self.index_access, IndexAddress::from(INDEXES_POOL_NAME))
- .put(&self.index_name, self.cache.get());
- }
-}
-
#[cfg(test)]
mod tests {
use std::borrow::Cow;
