File tree Expand file tree Collapse file tree
crates/bevy_ecs/src/world Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -520,6 +520,22 @@ impl World {
520520 /// Resources are "unique" data of a given type.
521521 #[ inline]
522522 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 > {
523539 let component_id = self . components . get_resource_id ( TypeId :: of :: < T > ( ) ) ?;
524540 let resource_archetype = self . archetypes . resource_mut ( ) ;
525541 let unique_components = resource_archetype. unique_components_mut ( ) ;
You can’t perform that action at this time.
0 commit comments