pub unsafe trait SystemParam {
type Item<'w>;
// Required methods
fn access() -> Vec<Access>;
unsafe fn fetch<'w>(world: UnsafeWorldCell) -> Self::Item<'w>;
}Expand description
A type that can be extracted from a World as a system parameter.
§Safety
Implementations must correctly report all data accessed via access().
fetch() may only touch the data declared in access(). The caller
guarantees that no other parameter has aliasing mutable access to the same
data — enforced at system registration time by conflict detection.
Each resource/component lives in its own heap allocation (Box inside
HashMap), so accesses to different TypeIds do not alias even through
the same *mut World.
Required Associated Types§
Required Methods§
Sourceunsafe fn fetch<'w>(world: UnsafeWorldCell) -> Self::Item<'w>
unsafe fn fetch<'w>(world: UnsafeWorldCell) -> Self::Item<'w>
Extract the parameter from the world.
§Safety
Caller must guarantee no aliasing mutable access to the data declared
in access(). The cell provides field-level access via addr_of!
to avoid creating intermediate &World or &mut World references,
preventing Stacked Borrows aliasing UB when multiple params are
fetched in sequence.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".