Skip to main content

ParameterList

Struct ParameterList 

Source
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>

Source

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.

Source

pub fn values(&self) -> &[(ParameterPoint, T)]

Get the underlying values.

Source

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.

Source

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> 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.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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, U> TryFrom<U> for T
where U: Into<T>,

Source§

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>,

Source§

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.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more