pub struct ParameterList<T> {
values: Vec<(ParameterPoint, T)>,
param_spaces: Vec<[Parameter; 7]>,
nodes: Vec<FlatNode>,
}Expand description
A list of biome parameter points with their associated values.
Uses an R-Tree for lookup matching vanilla’s Climate.ParameterList.
Fields§
§values: Vec<(ParameterPoint, T)>The biome entries (parameter point, value pairs)
param_spaces: Vec<[Parameter; 7]>Cached parameter spaces for each value (for distance computation in lastResult)
nodes: Vec<FlatNode>Flat R-Tree nodes in BFS order. Root is at index 0.
Implementations§
Source§impl<T> ParameterList<T>
impl<T> ParameterList<T>
Sourcepub fn new(values: Vec<(ParameterPoint, T)>) -> Self
pub fn new(values: Vec<(ParameterPoint, T)>) -> Self
Create a new parameter list from values, building an R-Tree index.
§Panics
Panics if values is empty.
Sourcepub fn values(&self) -> &[(ParameterPoint, T)]
pub fn values(&self) -> &[(ParameterPoint, T)]
Get the underlying values.
Sourcepub fn find_value(&self, target: &TargetPoint) -> &T
pub fn find_value(&self, target: &TargetPoint) -> &T
Find the best matching value for a target point (no caching).
Uses R-Tree search matching vanilla’s Climate.ParameterList.findValue().
Note: Vanilla warm-starts with lastResult via ThreadLocal, which can
affect tie-breaking on equal-distance candidates. This version starts
from i64::MAX (no warm-start). Use find_value_cached for the hot
path to match vanilla’s tie-breaking behavior.
§Panics
Panics if the R-Tree search fails to find any matching value.
Sourcepub fn find_value_cached(
&self,
target: &TargetPoint,
cache: &mut Option<usize>,
) -> &T
pub fn find_value_cached( &self, target: &TargetPoint, cache: &mut Option<usize>, ) -> &T
Find the best matching value with lastResult caching.
Matches vanilla’s Climate.ParameterList.findValue() with ThreadLocal
lastNode warm-starting. The cache stores the index of the last result,
which is used as the initial candidate for the next search, improving
both performance and tie-breaking behavior.
§Panics
Panics if the R-Tree search fails to find any matching value.
Auto Trait Implementations§
impl<T> Freeze for ParameterList<T>
impl<T> RefUnwindSafe for ParameterList<T>where
T: RefUnwindSafe,
impl<T> Send for ParameterList<T>where
T: Send,
impl<T> Sync for ParameterList<T>where
T: Sync,
impl<T> Unpin for ParameterList<T>where
T: Unpin,
impl<T> UnsafeUnpin for ParameterList<T>
impl<T> UnwindSafe for ParameterList<T>where
T: UnwindSafe,
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
§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<>>