-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cfade2f
commit eecb9fe
Showing
1 changed file
with
20 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
use core::{any::Any, cell::RefMut, hash::BuildHasherDefault}; | ||
use crate::{LockedMap, NoHasher, State, UniqueId}; | ||
|
||
use super::Cache2; | ||
|
||
#[derive(Default)] | ||
pub struct FastCache2 { | ||
pub nodes: LockedMap<UniqueId, Box<dyn Any>, BuildHasherDefault<NoHasher>>, | ||
} | ||
|
||
impl Cache2<Box<dyn Any>> for FastCache2 { | ||
#[inline] | ||
fn get_mut(&self, id: UniqueId, _len: usize) -> State<RefMut<Box<dyn Any>>> { | ||
self.nodes.get_mut(&id) | ||
} | ||
|
||
fn insert(&self, id: UniqueId, _len: usize, data: Box<dyn Any>) { | ||
self.nodes.insert(id, data); | ||
} | ||
} |