pub struct Registry { /* private fields */ }Expand description
Type-to-index mapping shared between WorldBuilder and World.
Contains only the type registry — no storage, no pointers. Passed to
IntoSystem::into_system and
SystemParam::init so systems can resolve
ResourceIds during driver setup.
Obtained via WorldBuilder::registry() or World::registry().
Implementations§
Source§impl Registry
impl Registry
Sourcepub fn id<T: 'static>(&self) -> ResourceId
pub fn id<T: 'static>(&self) -> ResourceId
Resolve the ResourceId for a type. Cold path — uses HashMap lookup.
§Panics
Panics if the resource type was not registered.
Sourcepub fn try_id<T: 'static>(&self) -> Option<ResourceId>
pub fn try_id<T: 'static>(&self) -> Option<ResourceId>
Try to resolve the ResourceId for a type. Returns None if the
type was not registered.
Sourcepub fn contains<T: 'static>(&self) -> bool
pub fn contains<T: 'static>(&self) -> bool
Returns true if a resource of type T has been registered.
Sourcepub fn check_access(&mut self, accesses: &[(Option<ResourceId>, &str)])
pub fn check_access(&mut self, accesses: &[(Option<ResourceId>, &str)])
Validate that a set of parameter accesses don’t conflict.
Two accesses conflict when they target the same ResourceId.
Called at construction time by into_system, into_callback,
and into_stage.
Fast path (≤128 resources): single u128 on the stack, zero heap.
Slow path (>128 resources): reusable Vec<u64> owned by Registry —
allocated once on first use, then cleared and reused.
§Panics
Panics if any resource is accessed by more than one parameter.