pub enum SelectionOrder {
Inherit,
Original,
Random,
Shuffled,
Sorted,
Probabilistic,
}Expand description
Defines the order in which elements are selected from a selector.
This enum controls how entities, values, or moves are ordered when iterating through a selector.
Variants§
Inherit
Inherit the selection order from the parent configuration.
If the parent is cached, defaults to Original.
If there is no parent, defaults to Random.
Original
Select elements in their original order.
Elements are returned in the order they appear in the underlying collection. This is deterministic and reproducible.
Random
Select elements in random order without shuffling.
Elements are selected randomly from the pool on each call to next(). The same element may be selected multiple times. This scales well because it does not require caching.
Shuffled
Select elements in random order by shuffling.
Elements are shuffled when a selection iterator is created. Each element will be selected exactly once (if all elements are consumed). Requires caching (at least step-level).
Sorted
Select elements in sorted order.
Elements are sorted according to a sorter before iteration. Each element will be selected exactly once (if all elements are consumed). Requires caching (at least step-level).
Probabilistic
Select elements based on probability weights.
Elements with higher probability have a greater chance of being selected. The same element may be selected multiple times. Requires caching (at least step-level).
Implementations§
Source§impl SelectionOrder
impl SelectionOrder
Sourcepub fn resolve(self, inherited: SelectionOrder) -> SelectionOrder
pub fn resolve(self, inherited: SelectionOrder) -> SelectionOrder
Sourcepub fn is_random(&self) -> bool
pub fn is_random(&self) -> bool
Returns true if this selection order implies random selection.
This is used to determine whether a selector should use random iteration or deterministic iteration.
Sourcepub fn requires_caching(&self) -> bool
pub fn requires_caching(&self) -> bool
Returns true if this selection order requires caching.
Some selection orders need to collect all elements before iteration can begin (e.g., Shuffled, Sorted, Probabilistic).
Sourcepub fn from_random_selection(random: bool) -> Self
pub fn from_random_selection(random: bool) -> Self
Converts from a boolean random selection flag.
§Arguments
random-trueforRandom,falseforOriginal
Sourcepub fn to_random_selection(&self) -> bool
pub fn to_random_selection(&self) -> bool
Trait Implementations§
Source§impl Clone for SelectionOrder
impl Clone for SelectionOrder
Source§fn clone(&self) -> SelectionOrder
fn clone(&self) -> SelectionOrder
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SelectionOrder
impl Debug for SelectionOrder
Source§impl Default for SelectionOrder
impl Default for SelectionOrder
Source§fn default() -> SelectionOrder
fn default() -> SelectionOrder
Source§impl Hash for SelectionOrder
impl Hash for SelectionOrder
Source§impl PartialEq for SelectionOrder
impl PartialEq for SelectionOrder
impl Copy for SelectionOrder
impl Eq for SelectionOrder
impl StructuralPartialEq for SelectionOrder
Auto Trait Implementations§
impl Freeze for SelectionOrder
impl RefUnwindSafe for SelectionOrder
impl Send for SelectionOrder
impl Sync for SelectionOrder
impl Unpin for SelectionOrder
impl UnwindSafe for SelectionOrder
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,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> 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 more