pub enum HeightProvider {
Constant(VerticalAnchor),
Uniform {
min_inclusive: VerticalAnchor,
max_inclusive: VerticalAnchor,
},
Trapezoid {
min_inclusive: VerticalAnchor,
max_inclusive: VerticalAnchor,
plateau: i32,
},
BiasedToBottom {
min_inclusive: VerticalAnchor,
max_inclusive: VerticalAnchor,
inner: i32,
},
VeryBiasedToBottom {
min_inclusive: VerticalAnchor,
max_inclusive: VerticalAnchor,
inner: i32,
},
}Expand description
An int-valued provider parameterised by world-generation bounds
(min_y, height).
Mirrors vanilla’s HeightProvider hierarchy.
Variants§
Constant(VerticalAnchor)
Always resolves to a fixed anchor.
Uniform
Uniform inclusive over [min, max].
Fields
min_inclusive: VerticalAnchorInclusive lower bound.
max_inclusive: VerticalAnchorInclusive upper bound.
Trapezoid
Sum of two next_i32_bounded draws — symmetric triangle when
plateau == 0, trapezoid otherwise.
Fields
min_inclusive: VerticalAnchorInclusive lower bound.
max_inclusive: VerticalAnchorInclusive upper bound.
BiasedToBottom
Biased toward the bottom: two nested nextInt draws.
Fields
min_inclusive: VerticalAnchorInclusive lower bound.
max_inclusive: VerticalAnchorInclusive upper bound.
VeryBiasedToBottom
Heavily biased toward the bottom: three nested nextInt draws.
Fields
min_inclusive: VerticalAnchorInclusive lower bound.
max_inclusive: VerticalAnchorInclusive upper bound.
Implementations§
Source§impl HeightProvider
impl HeightProvider
Sourcepub fn sample<R: Random + ?Sized>(
self,
random: &mut R,
min_y: i32,
height: i32,
) -> i32
pub fn sample<R: Random + ?Sized>( self, random: &mut R, min_y: i32, height: i32, ) -> i32
Sample a Y coordinate.
Matches vanilla’s HeightProvider.sample — including the “empty range
returns min” fallback (vanilla logs a warning once; we silently fall
back to min since this branch isn’t hit in practice).
Trait Implementations§
Source§impl Clone for HeightProvider
impl Clone for HeightProvider
Source§fn clone(&self) -> HeightProvider
fn clone(&self) -> HeightProvider
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for HeightProvider
Source§impl Debug for HeightProvider
impl Debug for HeightProvider
Source§impl<'de> Deserialize<'de> for HeightProvider
impl<'de> Deserialize<'de> for HeightProvider
Source§fn deserialize<D: Deserializer<'de>>(d: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(d: D) -> Result<Self, D::Error>
Auto Trait Implementations§
impl Freeze for HeightProvider
impl RefUnwindSafe for HeightProvider
impl Send for HeightProvider
impl Sync for HeightProvider
impl Unpin for HeightProvider
impl UnsafeUnpin for HeightProvider
impl UnwindSafe for HeightProvider
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
§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> ⓘ
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> ⓘ
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 moreArc<SyncMutex<>>