#[repr(u8)]
pub enum Density { Low = 1, Moderate = 2, High = 3, Ultra = 4, }
Expand description

Translates the DENSITY_* constants.

Variants§

§

Low = 1

§

Moderate = 2

§

High = 3

§

Ultra = 4

Implementations§

source§

impl Density

source

pub const fn thorium_amount(self) -> u32

Available on crate feature seasonal-season-5 only.

Amount of Thorium generated for each density level, replacing the amounts from Density::amount.

source§

impl Density

source

pub const fn amount(self) -> u32

Translates the MINERAL_DENSITY constant, the amount of mineral generated for each density level

source

pub const fn probability(self) -> f32

Translates the MINERAL_DENSITY_PROBABILITY constant.

These are values intended for subsequent percentage checks in the order Low -> Medium -> High -> Ultra. Use the enum_iterator::all iterator to iterate in this order.

If low or ultra on previous regeneration, or random number rolled at probability MINERAL_DENSITY_CHANGE, the mineral will determine a random new value (source):

  • Low: 10% chance
  • Moderate: 40% chance
  • High: 40% chance
  • Ultra: 10% chance

Trait Implementations§

source§

impl Clone for Density

source§

fn clone(&self) -> Density

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 Density

source§

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

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

impl<'de> Deserialize<'de> for Density

source§

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

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

impl From<Density> for JsValue

source§

fn from(value: Density) -> Self

Converts to this type from the input type.
source§

impl FromPrimitive for Density

source§

fn from_i64(n: i64) -> Option<Self>

Converts an i64 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
source§

fn from_u64(n: u64) -> Option<Self>

Converts an u64 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
source§

fn from_isize(n: isize) -> Option<Self>

Converts an isize to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
source§

fn from_i8(n: i8) -> Option<Self>

Converts an i8 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
source§

fn from_i16(n: i16) -> Option<Self>

Converts an i16 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
source§

fn from_i32(n: i32) -> Option<Self>

Converts an i32 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
source§

fn from_i128(n: i128) -> Option<Self>

Converts an i128 to return an optional value of this type. If the value cannot be represented by this type, then None is returned. Read more
source§

fn from_usize(n: usize) -> Option<Self>

Converts a usize to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
source§

fn from_u8(n: u8) -> Option<Self>

Converts an u8 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
source§

fn from_u16(n: u16) -> Option<Self>

Converts an u16 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
source§

fn from_u32(n: u32) -> Option<Self>

Converts an u32 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
source§

fn from_u128(n: u128) -> Option<Self>

Converts an u128 to return an optional value of this type. If the value cannot be represented by this type, then None is returned. Read more
source§

fn from_f32(n: f32) -> Option<Self>

Converts a f32 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
source§

fn from_f64(n: f64) -> Option<Self>

Converts a f64 to return an optional value of this type. If the value cannot be represented by this type, then None is returned. Read more
source§

impl FromWasmAbi for Density

§

type Abi = u32

The wasm ABI type that this converts from when coming back out from the ABI boundary.
source§

unsafe fn from_abi(js: u32) -> Self

Recover a Self from Self::Abi. Read more
source§

impl Hash for Density

source§

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

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 IntoWasmAbi for Density

§

type Abi = u32

The wasm ABI type that this converts into when crossing the ABI boundary.
source§

fn into_abi(self) -> u32

Convert self into Self::Abi so that it can be sent across the wasm ABI boundary.
source§

impl OptionFromWasmAbi for Density

source§

fn is_none(val: &u32) -> bool

Tests whether the argument is a “none” instance. If so it will be deserialized as None, and otherwise it will be passed to FromWasmAbi.
source§

impl OptionIntoWasmAbi for Density

source§

fn none() -> Self::Abi

Returns an ABI instance indicating “none”, which JS will interpret as the None branch of this option. Read more
source§

impl PartialEq for Density

source§

fn eq(&self, other: &Density) -> 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 Sequence for Density

source§

const CARDINALITY: usize = 4usize

Number of values of type Self. Read more
source§

fn next(&self) -> Option<Self>

Returns value following *self or None if this was the end. Read more
source§

fn previous(&self) -> Option<Self>

Returns value preceding *self or None if this was the beginning. Read more
source§

fn first() -> Option<Self>

Returns the first value of type Self. Read more
source§

fn last() -> Option<Self>

Returns the last value of type Self. Read more
source§

impl Serialize for Density

source§

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

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

impl TryFromJsValue for Density

§

type Error = JsValue

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

fn try_from_js_value( value: JsValue ) -> Result<Self, <Density as TryFromJsValue>::Error>

Performs the conversion.
source§

impl VectorFromWasmAbi for Density

§

type Abi = <Box<[JsValue]> as FromWasmAbi>::Abi

source§

unsafe fn vector_from_abi(js: Self::Abi) -> Box<[Density]>

source§

impl VectorIntoWasmAbi for Density

§

type Abi = <Box<[JsValue]> as IntoWasmAbi>::Abi

source§

fn vector_into_abi(vector: Box<[Density]>) -> Self::Abi

source§

impl WasmDescribe for Density

source§

impl WasmDescribeVector for Density

source§

impl Copy for Density

source§

impl Eq for Density

source§

impl StructuralEq for Density

source§

impl StructuralPartialEq for Density

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> 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<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> ReturnWasmAbi for T
where T: IntoWasmAbi,

§

type Abi = <T as IntoWasmAbi>::Abi

Same as IntoWasmAbi::Abi
source§

fn return_abi(self) -> <T as ReturnWasmAbi>::Abi

Same as IntoWasmAbi::into_abi, except that it may throw and never return in the case of Err.
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, 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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,