pub enum Section {
Uniform(u16),
Indexed(Box<Indexed>),
Direct(Box<Direct>),
}Expand description
A non-empty chunk section (see the module docs).
Variants§
Uniform(u16)
Every block has this state (never raw 0: an all-air section is not stored).
Indexed(Box<Indexed>)
At most 256 distinct states.
Direct(Box<Direct>)
More than 256 distinct states.
Implementations§
Source§impl Section
impl Section
Sourcepub fn get(&self, i: usize) -> u16
pub fn get(&self, i: usize) -> u16
Raw state of the block at section index i (see block_index).
Sourcepub fn heap_bytes(&self) -> usize
pub fn heap_bytes(&self) -> usize
Heap bytes owned by this section.
Sourcepub fn any_state(&self, f: impl Fn(u16) -> bool) -> bool
pub fn any_state(&self, f: impl Fn(u16) -> bool) -> bool
true when f holds for a raw state this section may hold: the uniform state, a
palette entry (an entry no block uses any more counts too) or a direct block. Cheap for
paletted sections (at most 256 entries).
Sourcepub fn for_each(&self, f: impl FnMut(usize, u16))
pub fn for_each(&self, f: impl FnMut(usize, u16))
Calls f(index, raw_state) for every block, in index order.
Trait Implementations§
Auto Trait Implementations§
impl Forget for Section
impl Freeze for Section
impl Move for Section
impl RefUnwindSafe for Section
impl Send for Section
impl Sync for Section
impl Unpin for Section
impl UnsafeUnpin for Sectionwhere
*const Indexed is !null: UnsafeUnpin,
PhantomData<Indexed>: UnsafeUnpin,
*const Direct is !null: UnsafeUnpin,
PhantomData<Direct>: UnsafeUnpin,
impl UnwindSafe for Section
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