pub(crate) struct RandomTickSectionBits {
words: Box<[AtomicU64]>,
section_count: usize,
}Expand description
Lock-free index of sections containing randomly-ticking blocks or fluids.
Section writers update their bit while still holding the section lock. Readers use relaxed loads because this metadata only decides whether to attempt work; section contents remain protected by the section lock and brief staleness is acceptable in the same way as Vanilla’s unsynchronized derived counters.
Fields§
§words: Box<[AtomicU64]>§section_count: usizeImplementations§
Source§impl RandomTickSectionBits
impl RandomTickSectionBits
fn new(section_count: usize) -> Self
fn set(&self, section_index: usize, randomly_ticking: bool)
fn contains(&self, section_index: usize) -> bool
Sourcepub(crate) fn next(&self, start: usize) -> Option<usize>
pub(crate) fn next(&self, start: usize) -> Option<usize>
Returns the next eligible section at or above start.
Each call reloads the current word, so a random-tick callback changing a later section can affect that later section in the same chunk pass.
pub(crate) fn is_empty(&self) -> bool
Trait Implementations§
Auto Trait Implementations§
impl Freeze for RandomTickSectionBits
impl RefUnwindSafe for RandomTickSectionBits
impl Send for RandomTickSectionBits
impl Sync for RandomTickSectionBits
impl Unpin for RandomTickSectionBits
impl UnsafeUnpin for RandomTickSectionBits
impl UnwindSafe for RandomTickSectionBits
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<>>