@@ -7,6 +7,7 @@ use crossbeam::queue::SegQueue;
7
7
use dashmap:: mapref:: one:: RefMut ;
8
8
9
9
use crate :: {
10
+ alloc:: Alloc ,
10
11
hash:: { FxDashMap , FxHasher } ,
11
12
plumbing:: transmute_lifetime,
12
13
Id , Runtime ,
@@ -18,21 +19,21 @@ pub(crate) struct StructMap<C>
18
19
where
19
20
C : Configuration ,
20
21
{
21
- map : Arc < FxDashMap < Id , Box < ValueStruct < C > > > > ,
22
+ map : Arc < FxDashMap < Id , Alloc < ValueStruct < C > > > > ,
22
23
23
24
/// When specific entities are deleted, their data is added
24
25
/// to this vector rather than being immediately freed. This is because we may` have
25
26
/// references to that data floating about that are tied to the lifetime of some
26
27
/// `&db` reference. This queue itself is not freed until we have an `&mut db` reference,
27
28
/// guaranteeing that there are no more references to it.
28
- deleted_entries : SegQueue < Box < ValueStruct < C > > > ,
29
+ deleted_entries : SegQueue < Alloc < ValueStruct < C > > > ,
29
30
}
30
31
31
32
pub ( crate ) struct StructMapView < C >
32
33
where
33
34
C : Configuration ,
34
35
{
35
- map : Arc < FxDashMap < Id , Box < ValueStruct < C > > > > ,
36
+ map : Arc < FxDashMap < Id , Alloc < ValueStruct < C > > > > ,
36
37
}
37
38
38
39
/// Return value for [`StructMap`][]'s `update` method.
79
80
pub fn insert < ' db > ( & ' db self , runtime : & ' db Runtime , value : ValueStruct < C > ) -> & ValueStruct < C > {
80
81
assert_eq ! ( value. created_at, runtime. current_revision( ) ) ;
81
82
82
- let boxed_value = Box :: new ( value) ;
83
+ let boxed_value = Alloc :: new ( value) ;
83
84
let pointer = std:: ptr:: addr_of!( * boxed_value) ;
84
85
85
86
let old_value = self . map . insert ( boxed_value. id , boxed_value) ;
@@ -165,7 +166,7 @@ where
165
166
/// * If the value is not present in the map.
166
167
/// * If the value has not been updated in this revision.
167
168
fn get_from_map < ' db > (
168
- map : & ' db FxDashMap < Id , Box < ValueStruct < C > > > ,
169
+ map : & ' db FxDashMap < Id , Alloc < ValueStruct < C > > > ,
169
170
runtime : & ' db Runtime ,
170
171
id : Id ,
171
172
) -> & ' db ValueStruct < C > {
@@ -230,7 +231,7 @@ pub(crate) struct UpdateRef<'db, C>
230
231
where
231
232
C : Configuration ,
232
233
{
233
- guard : RefMut < ' db , Id , Box < ValueStruct < C > > , FxHasher > ,
234
+ guard : RefMut < ' db , Id , Alloc < ValueStruct < C > > , FxHasher > ,
234
235
}
235
236
236
237
impl < ' db , C > UpdateRef < ' db , C >
0 commit comments