#[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 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 StructuralPartialEq for Density
Auto Trait Implementations§
impl Freeze for Density
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
impl<T> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
Source§type Abi = <T as IntoWasmAbi>::Abi
type Abi = <T as IntoWasmAbi>::Abi
Same as
IntoWasmAbi::AbiSource§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.