Commit 8f8639b3 authored by Luke Sandberg's avatar Luke Sandberg Committed by Luke Sandberg

remove a layer of indirection from the main storage map

parent 08668326
...@@ -75,7 +75,7 @@ enum ModifiedState { ...@@ -75,7 +75,7 @@ enum ModifiedState {
pub struct Storage { pub struct Storage {
snapshot_mode: AtomicBool, snapshot_mode: AtomicBool,
modified: FxDashMap<TaskId, ModifiedState>, modified: FxDashMap<TaskId, ModifiedState>,
map: FxDashMap<TaskId, Box<TaskStorage>>, map: FxDashMap<TaskId, TaskStorage>,
} }
impl Storage { impl Storage {
...@@ -243,7 +243,7 @@ impl Storage { ...@@ -243,7 +243,7 @@ impl Storage {
pub fn access_mut(&self, key: TaskId) -> StorageWriteGuard<'_> { pub fn access_mut(&self, key: TaskId) -> StorageWriteGuard<'_> {
let inner = match self.map.entry(key) { let inner = match self.map.entry(key) {
dashmap::mapref::entry::Entry::Occupied(e) => e.into_ref(), dashmap::mapref::entry::Entry::Occupied(e) => e.into_ref(),
dashmap::mapref::entry::Entry::Vacant(e) => e.insert(Box::new(TaskStorage::new())), dashmap::mapref::entry::Entry::Vacant(e) => e.insert(TaskStorage::new()),
}; };
StorageWriteGuard { StorageWriteGuard {
storage: self, storage: self,
...@@ -256,7 +256,7 @@ impl Storage { ...@@ -256,7 +256,7 @@ impl Storage {
key1: TaskId, key1: TaskId,
key2: TaskId, key2: TaskId,
) -> (StorageWriteGuard<'_>, StorageWriteGuard<'_>) { ) -> (StorageWriteGuard<'_>, StorageWriteGuard<'_>) {
let (a, b) = get_multiple_mut(&self.map, key1, key2, || Box::new(TaskStorage::new())); let (a, b) = get_multiple_mut(&self.map, key1, key2, TaskStorage::new);
( (
StorageWriteGuard { StorageWriteGuard {
storage: self, storage: self,
...@@ -277,7 +277,7 @@ impl Storage { ...@@ -277,7 +277,7 @@ impl Storage {
pub struct StorageWriteGuard<'a> { pub struct StorageWriteGuard<'a> {
storage: &'a Storage, storage: &'a Storage,
inner: RefMut<'a, TaskId, Box<TaskStorage>>, inner: RefMut<'a, TaskId, TaskStorage>,
} }
impl StorageWriteGuard<'_> { impl StorageWriteGuard<'_> {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment