Enum all_is_cubes::block::Resolution

source ·
#[non_exhaustive]
#[repr(u8)]
pub enum Resolution { R1 = 0, R2 = 1, R4 = 2, R8 = 3, R16 = 4, R32 = 5, R64 = 6, R128 = 7, }
Expand description

Scale factor between a Block and its component voxels.

This resolution cubed is the number of voxels making up a block.

Resolutions are always powers of 2. This ensures that the arithmetic is well-behaved (no division by zero, exact floating-point representation, and the potential of fixed-point representation), and that it is always possible to subdivide a block further (up to the limit) without shifting the existing voxel boundaries.

Note that while quite high resolutions are permitted, this does not mean that it is practical to routinely use full blocks at that resolution. For example, 64 × 64 × 64 = 262,144 voxels, occupying several megabytes just for color data. High resolutions are permitted for special purposes that do not necessarily use the full cube volume:

  • Thin blocks (e.g. 128 × 128 × 1) can display high resolution text and other 2D images.
  • Multi-block structures can be defined using Modifier::Zoom; their total size is limited by the resolution limit.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

R1 = 0

§

R2 = 1

§

R4 = 2

§

R8 = 3

§

R16 = 4

§

R32 = 5

§

R64 = 6

§

R128 = 7

Implementations§

source§

impl Resolution

source

pub const MAX: Resolution = Resolution::R128

The maximum available resolution.

source

pub const fn double(self) -> Option<Resolution>

Returns the Resolution that’s twice this one, or None at the limit.

source

pub const fn halve(self) -> Option<Resolution>

Returns the Resolution that’s half this one, or None if self is R1.

Trait Implementations§

source§

impl<'arbitrary> Arbitrary<'arbitrary> for Resolution

source§

fn arbitrary(u: &mut Unstructured<'arbitrary>) -> Result<Resolution, Error>

Generate an arbitrary value of Self from the given unstructured data. Read more
source§

fn arbitrary_take_rest(u: Unstructured<'arbitrary>) -> Result<Resolution, Error>

Generate an arbitrary value of Self from the entirety of the given unstructured data. Read more
source§

fn size_hint(depth: usize) -> (usize, Option<usize>)

Get a size hint for how many bytes out of an Unstructured this type needs to construct itself. Read more
source§

impl Clone for Resolution

source§

fn clone(&self) -> Resolution

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Resolution

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
source§

impl<'de> Deserialize<'de> for Resolution

source§

fn deserialize<D>( deserializer: D, ) -> Result<Resolution, <D as Deserializer<'de>>::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl Display for Resolution

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
source§

impl Div for Resolution

§

type Output = Option<Resolution>

The resulting type after applying the / operator.
source§

fn div(self, rhs: Resolution) -> <Resolution as Div>::Output

Performs the / operation. Read more
source§

impl Exhaust for Resolution

§

type Iter = ExhaustResolution

Type of iterator returned by Self::exhaust(). Read more
source§

fn exhaust() -> <Resolution as Exhaust>::Iter

Returns an iterator over all values of this type. Read more
source§

impl Hash for Resolution

source§

fn hash<__H>(&self, state: &mut __H)
where __H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl Mul for Resolution

§

type Output = Option<Resolution>

The resulting type after applying the * operator.
source§

fn mul(self, rhs: Resolution) -> <Resolution as Mul>::Output

Performs the * operation. Read more
source§

impl Ord for Resolution

source§

fn cmp(&self, other: &Resolution) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized + PartialOrd,

Restrict a value to a certain interval. Read more
source§

impl PartialEq for Resolution

source§

fn eq(&self, other: &Resolution) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialOrd for Resolution

source§

fn partial_cmp(&self, other: &Resolution) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl Serialize for Resolution

source§

fn serialize<S>( &self, serializer: S, ) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl TryFrom<i128> for Resolution

§

type Error = IntoResolutionError<i128>

The type returned in the event of a conversion error.
source§

fn try_from( value: i128, ) -> Result<Resolution, <Resolution as TryFrom<i128>>::Error>

Performs the conversion.
source§

impl TryFrom<i16> for Resolution

§

type Error = IntoResolutionError<i16>

The type returned in the event of a conversion error.
source§

fn try_from( value: i16, ) -> Result<Resolution, <Resolution as TryFrom<i16>>::Error>

Performs the conversion.
source§

impl TryFrom<i32> for Resolution

§

type Error = IntoResolutionError<i32>

The type returned in the event of a conversion error.
source§

fn try_from( value: i32, ) -> Result<Resolution, <Resolution as TryFrom<i32>>::Error>

Performs the conversion.
source§

impl TryFrom<i64> for Resolution

§

type Error = IntoResolutionError<i64>

The type returned in the event of a conversion error.
source§

fn try_from( value: i64, ) -> Result<Resolution, <Resolution as TryFrom<i64>>::Error>

Performs the conversion.
source§

impl TryFrom<isize> for Resolution

§

type Error = IntoResolutionError<isize>

The type returned in the event of a conversion error.
source§

fn try_from( value: isize, ) -> Result<Resolution, <Resolution as TryFrom<isize>>::Error>

Performs the conversion.
source§

impl TryFrom<u128> for Resolution

§

type Error = IntoResolutionError<u128>

The type returned in the event of a conversion error.
source§

fn try_from( value: u128, ) -> Result<Resolution, <Resolution as TryFrom<u128>>::Error>

Performs the conversion.
source§

impl TryFrom<u16> for Resolution

§

type Error = IntoResolutionError<u16>

The type returned in the event of a conversion error.
source§

fn try_from( value: u16, ) -> Result<Resolution, <Resolution as TryFrom<u16>>::Error>

Performs the conversion.
source§

impl TryFrom<u32> for Resolution

§

type Error = IntoResolutionError<u32>

The type returned in the event of a conversion error.
source§

fn try_from( value: u32, ) -> Result<Resolution, <Resolution as TryFrom<u32>>::Error>

Performs the conversion.
source§

impl TryFrom<u64> for Resolution

§

type Error = IntoResolutionError<u64>

The type returned in the event of a conversion error.
source§

fn try_from( value: u64, ) -> Result<Resolution, <Resolution as TryFrom<u64>>::Error>

Performs the conversion.
source§

impl TryFrom<usize> for Resolution

§

type Error = IntoResolutionError<usize>

The type returned in the event of a conversion error.
source§

fn try_from( value: usize, ) -> Result<Resolution, <Resolution as TryFrom<usize>>::Error>

Performs the conversion.
source§

impl Copy for Resolution

source§

impl Eq for Resolution

source§

impl StructuralPartialEq for Resolution

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Az for T

source§

fn az<Dst>(self) -> Dst
where T: Cast<Dst>,

Casts the value.
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<Src, Dst> CastFrom<Src> for Dst
where Src: Cast<Dst>,

source§

fn cast_from(src: Src) -> Dst

Casts the value.
source§

impl<T> CheckedAs for T

source§

fn checked_as<Dst>(self) -> Option<Dst>
where T: CheckedCast<Dst>,

Casts the value.
source§

impl<Src, Dst> CheckedCastFrom<Src> for Dst
where Src: CheckedCast<Dst>,

source§

fn checked_cast_from(src: Src) -> Option<Dst>

Casts the value.
source§

impl<T> CloneToUninit for T
where T: Copy,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> CloneToUninit for T
where T: Clone,

source§

default unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> Downcast for T
where T: Any,

source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
source§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
source§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IntoEither for T

source§

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 more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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 more
source§

impl<T> Is for T
where T: ?Sized,

§

type EqTo = T

source§

impl<T> OverflowingAs for T

source§

fn overflowing_as<Dst>(self) -> (Dst, bool)
where T: OverflowingCast<Dst>,

Casts the value.
source§

impl<Src, Dst> OverflowingCastFrom<Src> for Dst
where Src: OverflowingCast<Dst>,

source§

fn overflowing_cast_from(src: Src) -> (Dst, bool)

Casts the value.
source§

impl<T> SaturatingAs for T

source§

fn saturating_as<Dst>(self) -> Dst
where T: SaturatingCast<Dst>,

Casts the value.
source§

impl<Src, Dst> SaturatingCastFrom<Src> for Dst
where Src: SaturatingCast<Dst>,

source§

fn saturating_cast_from(src: Src) -> Dst

Casts the value.
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> UnwrappedAs for T

source§

fn unwrapped_as<Dst>(self) -> Dst
where T: UnwrappedCast<Dst>,

Casts the value.
source§

impl<Src, Dst> UnwrappedCastFrom<Src> for Dst
where Src: UnwrappedCast<Dst>,

source§

fn unwrapped_cast_from(src: Src) -> Dst

Casts the value.
source§

impl<T> WrappingAs for T

source§

fn wrapping_as<Dst>(self) -> Dst
where T: WrappingCast<Dst>,

Casts the value.
source§

impl<Src, Dst> WrappingCastFrom<Src> for Dst
where Src: WrappingCast<Dst>,

source§

fn wrapping_cast_from(src: Src) -> Dst

Casts the value.
source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,