@@ -10,7 +10,7 @@ use smallvec::SmallVec;
10
10
11
11
use crate :: error:: InteropError ;
12
12
13
- use super :: { ReflectAllocationId , ReflectBase } ;
13
+ use super :: { ReflectAllocation2 , ReflectBase } ;
14
14
15
15
#[ derive( Debug , Clone , PartialEq , Eq ) ]
16
16
pub struct ClaimOwner {
@@ -153,10 +153,14 @@ impl ReflectAccessId {
153
153
Ok ( Self :: for_component_id ( component_id) )
154
154
}
155
155
156
- pub fn for_allocation ( id : ReflectAllocationId ) -> Self {
156
+ pub fn for_allocation ( allocation : & ReflectAllocation2 ) -> Self {
157
+ debug_assert ! (
158
+ usize :: MAX as u128 <= u64 :: MAX as u128 ,
159
+ "usize assumption broken"
160
+ ) ;
157
161
Self {
158
162
kind : ReflectAccessKind :: Allocation ,
159
- id : id . id ( ) ,
163
+ id : allocation . unique_id ( ) as u64 ,
160
164
}
161
165
}
162
166
@@ -171,26 +175,20 @@ impl ReflectAccessId {
171
175
match base {
172
176
ReflectBase :: Resource ( id) => Self :: for_component_id ( id) ,
173
177
ReflectBase :: Component ( _, id) => Self :: for_component_id ( id) ,
174
- ReflectBase :: Owned ( id) => Self :: for_allocation ( id) ,
178
+ ReflectBase :: Owned ( id) => Self :: for_allocation ( & id) ,
175
179
}
176
180
}
177
181
}
178
182
179
183
impl From < ComponentId > for ReflectAccessId {
180
184
fn from ( value : ComponentId ) -> Self {
181
- Self {
182
- kind : ReflectAccessKind :: ComponentOrResource ,
183
- id : value. index ( ) as u64 ,
184
- }
185
+ ReflectAccessId :: for_component_id ( value)
185
186
}
186
187
}
187
188
188
- impl From < ReflectAllocationId > for ReflectAccessId {
189
- fn from ( value : ReflectAllocationId ) -> Self {
190
- Self {
191
- kind : ReflectAccessKind :: Allocation ,
192
- id : value. id ( ) ,
193
- }
189
+ impl From < & ReflectAllocation2 > for ReflectAccessId {
190
+ fn from ( value : & ReflectAllocation2 ) -> Self {
191
+ ReflectAccessId :: for_allocation ( value)
194
192
}
195
193
}
196
194
@@ -200,12 +198,6 @@ impl From<ReflectAccessId> for ComponentId {
200
198
}
201
199
}
202
200
203
- impl From < ReflectAccessId > for ReflectAllocationId {
204
- fn from ( val : ReflectAccessId ) -> Self {
205
- ReflectAllocationId :: new ( val. id )
206
- }
207
- }
208
-
209
201
#[ derive( Debug , Default ) ]
210
202
pub struct AccessMap {
211
203
individual_accesses : DashMap < u64 , AccessCount > ,
0 commit comments