pub struct LightUpdateNotificationCache {
layout: LightCacheLayout,
marked: Box<[bool]>,
}Expand description
Section-slot notification flags used while publishing visible light updates.
ScalableLux keeps notifyUpdateCache beside its nibble cache and marks the
cached sections touched by a block’s one-block lighting neighborhood. The
light engine later scans the same section slots while publishing dirty
nibbles and notifying clients.
Fields§
§layout: LightCacheLayout§marked: Box<[bool]>Implementations§
Source§impl LightUpdateNotificationCache
impl LightUpdateNotificationCache
Sourcepub fn new(layout: LightCacheLayout) -> Self
pub fn new(layout: LightCacheLayout) -> Self
Creates an empty notification cache for a light-engine cache window.
Sourcepub const fn layout(&self) -> LightCacheLayout
pub const fn layout(&self) -> LightCacheLayout
Returns the layout this notification cache is indexed by.
Sourcepub fn mark_section(&mut self, section_pos: SectionPos) -> bool
pub fn mark_section(&mut self, section_pos: SectionPos) -> bool
Marks a cached section, returning true only when it was newly marked.
Sourcepub fn mark_block_neighborhood(&mut self, block_pos: BlockPos) -> Option<usize>
pub fn mark_block_neighborhood(&mut self, block_pos: BlockPos) -> Option<usize>
Marks every cached section touched by a block’s lighting neighborhood.
Returns None if the full one-block neighborhood is not inside this
cache window, so callers do not accidentally publish a partial update.
Sourcepub fn is_marked_section(&self, section_pos: SectionPos) -> bool
pub fn is_marked_section(&self, section_pos: SectionPos) -> bool
Returns whether a cached section is marked for notification.
Sourcepub fn is_marked_section_slot(&self, section_slot: usize) -> bool
pub fn is_marked_section_slot(&self, section_slot: usize) -> bool
Returns whether a section slot is marked for notification.
Sourcepub fn marked_section_positions(&self) -> impl Iterator<Item = SectionPos> + '_
pub fn marked_section_positions(&self) -> impl Iterator<Item = SectionPos> + '_
Iterates marked section positions in cache-slot order.
fn mark_section_slot(&mut self, section_slot: usize) -> bool
Trait Implementations§
Source§impl Clone for LightUpdateNotificationCache
impl Clone for LightUpdateNotificationCache
Source§fn clone(&self) -> LightUpdateNotificationCache
fn clone(&self) -> LightUpdateNotificationCache
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for LightUpdateNotificationCache
impl RefUnwindSafe for LightUpdateNotificationCache
impl Send for LightUpdateNotificationCache
impl Sync for LightUpdateNotificationCache
impl Unpin for LightUpdateNotificationCache
impl UnsafeUnpin for LightUpdateNotificationCache
impl UnwindSafe for LightUpdateNotificationCache
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreArc<SyncMutex<>>