pub struct MutReceiver { /* private fields */ }Expand description
Per-user receiver that accumulates dirty bits for a single component and notifies the user’s [DirtySet] on first mutation.
Implementations§
Source§impl MutReceiver
impl MutReceiver
Sourcepub fn new(diff_mask_length: u8) -> Self
pub fn new(diff_mask_length: u8) -> Self
Creates a MutReceiver with an atomic diff mask of diff_mask_length bytes.
Sourcepub fn attach_notifier(&self, notifier: DirtyNotifier)
pub fn attach_notifier(&self, notifier: DirtyNotifier)
Installed once per receiver by UserDiffHandler::register_component. Cheap no-op on re-attachment (OnceLock::set returns Err, ignored).
Sourcepub fn mask_snapshot(&self) -> DiffMask
pub fn mask_snapshot(&self) -> DiffMask
Snapshot the receiver’s current mask into an owned DiffMask.
Used by world_writer when copying the mask into sent_updates
before clearing the receiver. Replaces the prior
RwLockReadGuard<'_, DiffMask> API which forced callers to clone
while holding a read lock.
Sourcepub fn mask_byte(&self, index: usize) -> u8
pub fn mask_byte(&self, index: usize) -> u8
Read one byte of the receiver’s mask. Cheaper than mask_snapshot()
when callers only need a single byte (currently unused but kept as
the obvious primitive on top of the atomic representation).
Sourcepub fn diff_mask_is_clear(&self) -> bool
pub fn diff_mask_is_clear(&self) -> bool
Returns true if no property bits are currently set in this receiver’s diff mask.
Sourcepub fn mutate(&self, property_index: u8)
pub fn mutate(&self, property_index: u8)
Marks property_index dirty in the diff mask, notifying the dirty queue if the mask transitions from clean to dirty.
Sourcepub fn or_mask(&self, other_mask: &DiffMask)
pub fn or_mask(&self, other_mask: &DiffMask)
ORs other_mask into the diff mask, notifying the dirty queue if the mask transitions from clean to dirty.
Sourcepub fn clear_mask(&self)
pub fn clear_mask(&self)
Clears all bits in the diff mask and notifies the dirty queue if the mask was dirty.
Trait Implementations§
Source§impl Clone for MutReceiver
impl Clone for MutReceiver
Source§fn clone(&self) -> MutReceiver
fn clone(&self) -> MutReceiver
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more