#[repr(u8)]pub enum Density {
Low = 1,
Moderate = 2,
High = 3,
Ultra = 4,
}
Expand description
Translates the DENSITY_*
constants.
Variants§
Implementations§
source§impl Density
impl Density
sourcepub const fn thorium_amount(self) -> u32
Available on crate feature seasonal-season-5
only.
pub const fn thorium_amount(self) -> u32
seasonal-season-5
only.Amount of Thorium
generated for each density
level, replacing the amounts from Density::amount
.
source§impl Density
impl Density
sourcepub const fn amount(self) -> u32
pub const fn amount(self) -> u32
Translates the MINERAL_DENSITY
constant, the amount of mineral
generated for each density level
sourcepub const fn probability(self) -> f32
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<'de> Deserialize<'de> for Density
impl<'de> Deserialize<'de> for Density
source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
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 FromPrimitive for Density
impl FromPrimitive for Density
source§fn from_i64(n: i64) -> Option<Self>
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>
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>
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>
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>
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>
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>
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 moresource§fn from_usize(n: usize) -> Option<Self>
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>
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>
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>
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>
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 moresource§impl FromWasmAbi for Density
impl FromWasmAbi for Density
source§impl IntoWasmAbi for Density
impl IntoWasmAbi for Density
source§impl OptionFromWasmAbi for Density
impl OptionFromWasmAbi for Density
source§impl OptionIntoWasmAbi for Density
impl OptionIntoWasmAbi for Density
source§impl PartialEq for Density
impl PartialEq for Density
source§impl Sequence for Density
impl Sequence for Density
source§impl TryFromJsValue for Density
impl TryFromJsValue for Density
source§impl VectorFromWasmAbi for Density
impl VectorFromWasmAbi for Density
source§impl VectorIntoWasmAbi for Density
impl VectorIntoWasmAbi for Density
impl Copy for Density
impl Eq for Density
impl StructuralEq for Density
impl StructuralPartialEq for Density
Auto Trait Implementations§
impl RefUnwindSafe for Density
impl Send for Density
impl Sync for Density
impl Unpin for Density
impl UnwindSafe for Density
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> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
impl<T> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
§type Abi = <T as IntoWasmAbi>::Abi
type Abi = <T as IntoWasmAbi>::Abi
Same as
IntoWasmAbi::Abi
source§fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
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
.