pub struct LightLayerEdit<'a> {
layout: LightCacheLayout,
layer: LightLayer,
chunks: LightChunkSlotArray<RwLockWriteGuard<'a, ChunkLightData>>,
sections: LightSectionSlotArray<LightSectionEditEntry>,
removed_missing_sections: LightSectionSlotArray<StoredLightSectionEdit>,
edits: Vec<LightSectionEdit>,
}Expand description
Scoped mutable light edits for one layer and one workset.
Fields§
§layout: LightCacheLayout§layer: LightLayer§chunks: LightChunkSlotArray<RwLockWriteGuard<'a, ChunkLightData>>§sections: LightSectionSlotArray<LightSectionEditEntry>§removed_missing_sections: LightSectionSlotArray<StoredLightSectionEdit>§edits: Vec<LightSectionEdit>Implementations§
Source§impl LightLayerEdit<'_>
impl LightLayerEdit<'_>
Sourcepub const fn layout(&self) -> LightCacheLayout
pub const fn layout(&self) -> LightCacheLayout
Returns this edit cache’s layout.
Sourcepub const fn layer(&self) -> LightLayer
pub const fn layer(&self) -> LightLayer
Returns this edit cache’s light layer.
Sourcepub fn get(&self, cached_block: CachedLightBlock) -> u8
pub fn get(&self, cached_block: CachedLightBlock) -> u8
Returns an edited light value for a cached light block.
Sourcepub fn has_non_missing(&self, cached_block: CachedLightBlock) -> bool
pub fn has_non_missing(&self, cached_block: CachedLightBlock) -> bool
Returns whether a cached block has a non-missing edited section.
Sourcepub fn has_non_missing_section(&self, section_pos: SectionPos) -> bool
pub fn has_non_missing_section(&self, section_pos: SectionPos) -> bool
Returns whether a cached section has a non-missing edited section.
Sourcepub fn is_section_missing(&self, section_pos: SectionPos) -> bool
pub fn is_section_missing(&self, section_pos: SectionPos) -> bool
Returns whether a cached section has an edited missing section.
Sourcepub fn has_cached_section(&self, section_pos: SectionPos) -> bool
pub fn has_cached_section(&self, section_pos: SectionPos) -> bool
Returns whether a cached section was admitted into the edit cache.
Sourcepub fn has_light_data_section(&self, section_pos: SectionPos) -> bool
pub fn has_light_data_section(&self, section_pos: SectionPos) -> bool
Returns true when a cached section has edited light data.
Sourcepub fn section_empty(&self, section_pos: SectionPos) -> Option<bool>
pub fn section_empty(&self, section_pos: SectionPos) -> Option<bool>
Returns known real-section emptiness for a writable cached chunk column.
Sourcepub fn set_section_empty(
&mut self,
section_pos: SectionPos,
empty: bool,
) -> Option<bool>
pub fn set_section_empty( &mut self, section_pos: SectionPos, empty: bool, ) -> Option<bool>
Updates the cached light layer’s real-section emptiness map.
Returns the previous value when the target layer and section are writable.
Sourcepub fn set_section_non_missing(&mut self, section_pos: SectionPos) -> bool
pub fn set_section_non_missing(&mut self, section_pos: SectionPos) -> bool
Marks a cached light section non-missing without allocating packed bytes.
Returns false when the section has no writable cached edit entry.
Sourcepub fn set_section_missing(&mut self, section_pos: SectionPos) -> bool
pub fn set_section_missing(&mut self, section_pos: SectionPos) -> bool
Marks a cached light section missing and drops edited bytes.
Returns false when the section has no writable cached edit entry.
Sourcepub fn set_section_internal(&mut self, section_pos: SectionPos) -> bool
pub fn set_section_internal(&mut self, section_pos: SectionPos) -> bool
Hides a cached section from external packet/save conversion.
Missing and visible zero sections become missing, matching old
Uninitialized -> Null hidden-state behavior.
Sourcepub fn reset_chunk_sections_to_missing(&mut self, chunk_pos: ChunkPos) -> bool
pub fn reset_chunk_sections_to_missing(&mut self, chunk_pos: ChunkPos) -> bool
Replaces one cached chunk column’s layer sections with fresh missing sections.
Initial chunk lighting lights into a fresh center layer, so previous neighbor-written data cannot become the center chunk’s canonical light.
Sourcepub fn rewrite_missing_sections_for_skylight(&mut self)
pub fn rewrite_missing_sections_for_skylight(&mut self)
Removes missing sky sections from the temporary edit cache.
Later materialization can create transient sections for propagation; those transient sections notify on commit but do not write into chunk storage.
Sourcepub fn materialize_removed_missing_section(
&mut self,
section_pos: SectionPos,
) -> bool
pub fn materialize_removed_missing_section( &mut self, section_pos: SectionPos, ) -> bool
Materializes a sky section that was removed from the temporary edit cache.
Returns false when the section was not part of the writable cache or was
not removed by Self::rewrite_missing_sections_for_skylight.
Sourcepub fn fill_section(&mut self, section_pos: SectionPos, value: u8) -> bool
pub fn fill_section(&mut self, section_pos: SectionPos, value: u8) -> bool
Fills a cached section with one edited light value.
Returns false when the section has no writable cached edit entry.
Sourcepub fn extrude_lower_from_first_section_above(
&mut self,
section_pos: SectionPos,
) -> bool
pub fn extrude_lower_from_first_section_above( &mut self, section_pos: SectionPos, ) -> bool
Extrudes the lower row from the first non-missing cached section above.
Returns false when the target section or source section is unavailable.
Sourcepub fn get_at_section_index(
&self,
section_slot: usize,
local_index: usize,
) -> u8
pub fn get_at_section_index( &self, section_slot: usize, local_index: usize, ) -> u8
Returns an edited light value for a section slot and local light index.
Sourcepub fn set(&mut self, cached_block: CachedLightBlock, level: u8) -> bool
pub fn set(&mut self, cached_block: CachedLightBlock, level: u8) -> bool
Sets an edited light value for a cached light block.
Returns false when no writable non-missing section was cached for the block.
Sourcepub fn set_at_section_index(
&mut self,
section_slot: usize,
local_index: usize,
level: u8,
) -> bool
pub fn set_at_section_index( &mut self, section_slot: usize, local_index: usize, level: u8, ) -> bool
Sets an edited light value for a section slot and local light index.
Returns false when no writable non-missing section was cached for the slot.
Sourcepub fn commit(
self,
notifications: Option<&LightUpdateNotificationCache>,
on_update: impl FnMut(SectionPos),
) -> usize
pub fn commit( self, notifications: Option<&LightUpdateNotificationCache>, on_update: impl FnMut(SectionPos), ) -> usize
Commits edited stored sections and publishes changed or notified sections.
fn build_section_edits( layout: LightCacheLayout, layer: LightLayer, chunks: &LightChunkSlotArray<RwLockWriteGuard<'_, ChunkLightData>>, edits: &mut Vec<LightSectionEdit>, ) -> LightSectionSlotArray<LightSectionEditEntry>
fn commit_stored_section( &mut self, target: StoredLightSectionEdit, edit_index: usize, ) -> bool
fn set_section_slot_non_missing(&mut self, section_slot: usize) -> bool
fn section_edit(&self, section_slot: usize) -> Option<&LightSectionEdit>
fn section_edit_mut( &mut self, section_slot: usize, ) -> Option<&mut LightSectionEdit>
const fn layer_storage( light_data: &ChunkLightData, layer: LightLayer, ) -> &ChunkLightLayerStorage
const fn layer_storage_mut( light_data: &mut ChunkLightData, layer: LightLayer, ) -> &mut ChunkLightLayerStorage
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for LightLayerEdit<'a>
impl<'a> !Send for LightLayerEdit<'a>
impl<'a> !UnwindSafe for LightLayerEdit<'a>
impl<'a> Freeze for LightLayerEdit<'a>
impl<'a> Sync for LightLayerEdit<'a>
impl<'a> Unpin for LightLayerEdit<'a>
impl<'a> UnsafeUnpin for LightLayerEdit<'a>
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
§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<>>