File tree 1 file changed +16
-0
lines changed
crates/bevy_ecs/src/world
1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -520,6 +520,22 @@ impl World {
520
520
/// Resources are "unique" data of a given type.
521
521
#[ inline]
522
522
pub fn remove_resource < T : Component > ( & mut self ) -> Option < T > {
523
+ // SAFE: T is Send + Sync
524
+ unsafe { self . remove_resource_unchecked ( ) }
525
+ }
526
+
527
+ #[ inline]
528
+ pub fn remove_non_send < T : ' static > ( & mut self ) -> Option < T > {
529
+ self . validate_non_send_access :: < T > ( ) ;
530
+ // SAFE: we are on main thread
531
+ unsafe { self . remove_resource_unchecked ( ) }
532
+ }
533
+
534
+ #[ inline]
535
+ /// # Safety
536
+ /// make sure you're on main thread if T isn't Send + Sync
537
+ #[ allow( unused_unsafe) ]
538
+ pub unsafe fn remove_resource_unchecked < T : ' static > ( & mut self ) -> Option < T > {
523
539
let component_id = self . components . get_resource_id ( TypeId :: of :: < T > ( ) ) ?;
524
540
let resource_archetype = self . archetypes . resource_mut ( ) ;
525
541
let unique_components = resource_archetype. unique_components_mut ( ) ;
You can’t perform that action at this time.
0 commit comments