@@ -119,6 +119,22 @@ impl<'w> InteriorMutableWorld<'w> {
119
119
& self . 0 . bundles
120
120
}
121
121
122
+ /// Reads the current change tick of this world.
123
+ #[ inline]
124
+ pub fn read_change_tick ( & self ) -> u32 {
125
+ self . 0 . read_change_tick ( )
126
+ }
127
+
128
+ #[ inline]
129
+ pub fn last_change_tick ( & self ) -> u32 {
130
+ self . 0 . last_change_tick ( )
131
+ }
132
+
133
+ #[ inline]
134
+ pub fn increment_change_tick ( & self ) -> u32 {
135
+ self . 0 . increment_change_tick ( )
136
+ }
137
+
122
138
/// Retrieves an [`InteriorMutableEntityRef`] that exposes read and write operations for the given `entity`.
123
139
/// Similar to the [`InteriorMutableWorld`], you are in charge of making sure that no aliasing rules are violated.
124
140
pub fn get_entity ( & self , entity : Entity ) -> Option < InteriorMutableEntityRef < ' w > > {
@@ -206,7 +222,7 @@ impl<'w> InteriorMutableWorld<'w> {
206
222
// - index is in-bounds because the column is initialized and non-empty
207
223
// - the caller promises that no other reference to the ticks of the same row can exist at the same time
208
224
let ticks = unsafe {
209
- TicksMut :: from_tick_cells ( ticks, self . 0 . last_change_tick ( ) , self . 0 . read_change_tick ( ) )
225
+ TicksMut :: from_tick_cells ( ticks, self . last_change_tick ( ) , self . read_change_tick ( ) )
210
226
} ;
211
227
212
228
Some ( MutUntyped {
@@ -250,7 +266,7 @@ impl<'w> InteriorMutableWorld<'w> {
250
266
// - This caller ensures that nothing aliases `ticks`.
251
267
// - index is in-bounds because the column is initialized and non-empty
252
268
let ticks = unsafe {
253
- TicksMut :: from_tick_cells ( ticks, self . 0 . last_change_tick ( ) , self . 0 . read_change_tick ( ) )
269
+ TicksMut :: from_tick_cells ( ticks, self . last_change_tick ( ) , self . read_change_tick ( ) )
254
270
} ;
255
271
256
272
Some ( Mut {
@@ -283,11 +299,7 @@ impl<'w> InteriorMutableWorld<'w> {
283
299
value : unsafe { ptr. assert_unique ( ) . deref_mut ( ) } ,
284
300
// SAFETY: caller ensures unique access
285
301
ticks : unsafe {
286
- TicksMut :: from_tick_cells (
287
- ticks,
288
- self . 0 . last_change_tick ( ) ,
289
- self . 0 . read_change_tick ( ) ,
290
- )
302
+ TicksMut :: from_tick_cells ( ticks, self . last_change_tick ( ) , self . read_change_tick ( ) )
291
303
} ,
292
304
} )
293
305
}
@@ -393,10 +405,7 @@ impl<'w> InteriorMutableEntityRef<'w> {
393
405
pub unsafe fn get_mut < T : Component > ( & self ) -> Option < Mut < ' w , T > > {
394
406
// SAFETY: same safety requirements
395
407
unsafe {
396
- self . get_mut_using_ticks (
397
- self . world . 0 . last_change_tick ( ) ,
398
- self . world . 0 . read_change_tick ( ) ,
399
- )
408
+ self . get_mut_using_ticks ( self . world . last_change_tick ( ) , self . world . read_change_tick ( ) )
400
409
}
401
410
}
402
411
@@ -487,8 +496,8 @@ impl<'w> InteriorMutableEntityRef<'w> {
487
496
value : value. assert_unique ( ) ,
488
497
ticks : TicksMut :: from_tick_cells (
489
498
cells,
490
- self . world . 0 . last_change_tick ,
491
- self . world . 0 . read_change_tick ( ) ,
499
+ self . world . last_change_tick ( ) ,
500
+ self . world . read_change_tick ( ) ,
492
501
) ,
493
502
} )
494
503
}
0 commit comments