pub struct SharedRegion<T: GpuValue, const OWNER: u8> { /* private fields */ }Expand description
A region of shared memory owned by a specific role.
The key insight: shared memory races happen because ownership is implicit. By making ownership explicit, we prevent races at the type level.
OWNER is a type-level tag (u8 discriminator) that prevents cross-type access
at compile time. The owner field carries the runtime lane range metadata
(which lanes belong to this role). These encode different concerns: OWNER
prevents mixing regions at the type level; Role describes the lane geometry.
Ownership is enforced at compile time only (const generic tag). The owner
field is metadata for debugging — write/read do not verify the caller’s
role at runtime. In a real GPU implementation, kernel launch guarantees
would replace runtime checks.
Implementations§
Auto Trait Implementations§
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more