pub enum LightSectionData {
Homogeneous(u8),
Packed(Box<[u8; 2048]>),
}Expand description
Storage representation for one present light section.
Variants§
Homogeneous(u8)
One light value applies to the whole section.
Packed(Box<[u8; 2048]>)
Vanilla low-nibble-first packed light values.
Implementations§
Source§impl LightSectionData
impl LightSectionData
Sourcepub const fn homogeneous(value: u8) -> Self
pub const fn homogeneous(value: u8) -> Self
Creates homogeneous section data, masking to the vanilla light range.
Sourcepub fn get(&self, x: usize, y: usize, z: usize) -> u8
pub fn get(&self, x: usize, y: usize, z: usize) -> u8
Returns the light value at local section coordinates.
Sourcepub fn set(&mut self, x: usize, y: usize, z: usize, value: u8)
pub fn set(&mut self, x: usize, y: usize, z: usize, value: u8)
Sets the light value at local section coordinates.
Sourcepub const fn is_homogeneous(&self) -> bool
pub const fn is_homogeneous(&self) -> bool
Returns true when this section is represented by one homogeneous value.
Sourcepub const fn is_empty(&self) -> bool
pub const fn is_empty(&self) -> bool
Returns true when this section is the visible empty section state.
Sourcepub fn is_all_zero(&self) -> bool
pub fn is_all_zero(&self) -> bool
Returns true when every packed light value is zero.
Sourcepub fn to_bytes(&self) -> Box<[u8; 2048]>
pub fn to_bytes(&self) -> Box<[u8; 2048]>
Returns packed bytes without changing the section representation.
const fn get_from_packed(data: &[u8; 2048], index: usize) -> u8
const fn set_in_packed(data: &mut [u8; 2048], index: usize, value: u8)
const fn index(x: usize, y: usize, z: usize) -> usize
const fn pack_filled(value: u8) -> u8
Trait Implementations§
Source§impl Clone for LightSectionData
impl Clone for LightSectionData
Source§fn clone(&self) -> LightSectionData
fn clone(&self) -> LightSectionData
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for LightSectionData
impl Debug for LightSectionData
impl Eq for LightSectionData
Source§impl PartialEq for LightSectionData
impl PartialEq for LightSectionData
impl StructuralPartialEq for LightSectionData
Auto Trait Implementations§
impl Freeze for LightSectionData
impl RefUnwindSafe for LightSectionData
impl Send for LightSectionData
impl Sync for LightSectionData
impl Unpin for LightSectionData
impl UnsafeUnpin for LightSectionData
impl UnwindSafe for LightSectionData
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compares
self with key and returns true if they are equal.§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<>>