pub struct SectionHolder {
section: SyncRwLock<ChunkSection>,
randomly_ticking_sections: Arc<RandomTickSectionBits>,
section_index: usize,
}Expand description
A wrapper around a chunk section.
Fields§
§section: SyncRwLock<ChunkSection>The chunk section data (requires lock to access).
randomly_ticking_sections: Arc<RandomTickSectionBits>Shared lock-free random-tick section index.
section_index: usizeImplementations§
Source§impl SectionHolder
impl SectionHolder
Sourcepub fn new(section: ChunkSection) -> Self
pub fn new(section: ChunkSection) -> Self
Creates a new section holder.
fn with_random_tick_index( section: ChunkSection, randomly_ticking_sections: Arc<RandomTickSectionBits>, section_index: usize, ) -> Self
Sourcepub fn is_randomly_ticking(&self) -> bool
pub fn is_randomly_ticking(&self) -> bool
Returns true if this section contains any randomly-ticking blocks or fluids.
The mirror may briefly be stale relative to a concurrent section writer. Section contents and the authoritative counter remain protected by the section lock.
Sourcepub fn read(&self) -> RwLockReadGuard<'_, ChunkSection>
pub fn read(&self) -> RwLockReadGuard<'_, ChunkSection>
Acquires a read lock on the section.
Sourcepub fn try_read(&self) -> Option<RwLockReadGuard<'_, ChunkSection>>
pub fn try_read(&self) -> Option<RwLockReadGuard<'_, ChunkSection>>
Attempts to acquire a read lock on the section.
Sourcepub fn write(&self) -> SectionWriteGuard<'_>
pub fn write(&self) -> SectionWriteGuard<'_>
Acquires a write lock on the section.
Sourcepub fn try_write(&self) -> Option<SectionWriteGuard<'_>>
pub fn try_write(&self) -> Option<SectionWriteGuard<'_>>
Attempts to acquire a write lock on the section.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for SectionHolder
impl !RefUnwindSafe for SectionHolder
impl Send for SectionHolder
impl Sync for SectionHolder
impl Unpin for SectionHolder
impl UnsafeUnpin for SectionHolder
impl UnwindSafe for SectionHolder
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
§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> ⓘ
Converts
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> ⓘ
Converts
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 moreWraps this value in an
Arc<SyncMutex<>>