pub struct DefaultPillarSelector<S, V, E>where
S: PlanningSolution,
V: Clone + Eq + Hash + Send + Sync + 'static,
E: Fn(&dyn ScoreDirector<S>, usize, usize) -> Option<V> + Send + Sync,{ /* private fields */ }Expand description
A pillar selector that groups entities by their variable value.
This selector uses an entity selector to get entities, then groups them by the value of a specified variable using a value extractor function.
§Zero-Erasure Design
The extractor function E is stored as a concrete generic type parameter,
eliminating virtual dispatch overhead when grouping entities by value.
Implementations§
Source§impl<S, V, E> DefaultPillarSelector<S, V, E>
impl<S, V, E> DefaultPillarSelector<S, V, E>
Sourcepub fn new(
entity_selector: Box<dyn EntitySelector<S>>,
descriptor_index: usize,
variable_name: &'static str,
value_extractor: E,
) -> Self
pub fn new( entity_selector: Box<dyn EntitySelector<S>>, descriptor_index: usize, variable_name: &'static str, value_extractor: E, ) -> Self
Creates a new default pillar selector.
§Arguments
entity_selector- The entity selector to get entities fromdescriptor_index- The entity descriptor indexvariable_name- The variable name for groupingvalue_extractor- Function to extract the grouping value from an entity
Sourcepub fn with_sub_pillar_config(self, config: SubPillarConfig) -> Self
pub fn with_sub_pillar_config(self, config: SubPillarConfig) -> Self
Sets the sub-pillar configuration.
Sourcepub fn variable_name(&self) -> &str
pub fn variable_name(&self) -> &str
Returns the variable name.
Trait Implementations§
Source§impl<S, V, E> Debug for DefaultPillarSelector<S, V, E>
impl<S, V, E> Debug for DefaultPillarSelector<S, V, E>
Source§impl<S, V, E> PillarSelector<S> for DefaultPillarSelector<S, V, E>
impl<S, V, E> PillarSelector<S> for DefaultPillarSelector<S, V, E>
Source§fn iter<'a>(
&'a self,
score_director: &'a dyn ScoreDirector<S>,
) -> Box<dyn Iterator<Item = Pillar> + 'a>
fn iter<'a>( &'a self, score_director: &'a dyn ScoreDirector<S>, ) -> Box<dyn Iterator<Item = Pillar> + 'a>
Returns an iterator over pillars. Read more
Source§fn size(&self, score_director: &dyn ScoreDirector<S>) -> usize
fn size(&self, score_director: &dyn ScoreDirector<S>) -> usize
Returns the approximate number of pillars.
Source§fn descriptor_index(&self) -> usize
fn descriptor_index(&self) -> usize
Returns the descriptor index this selector operates on.
Source§fn is_never_ending(&self) -> bool
fn is_never_ending(&self) -> bool
Returns true if this selector may return the same pillar multiple times.
Auto Trait Implementations§
impl<S, V, E> Freeze for DefaultPillarSelector<S, V, E>where
E: Freeze,
impl<S, V, E> !RefUnwindSafe for DefaultPillarSelector<S, V, E>
impl<S, V, E> Send for DefaultPillarSelector<S, V, E>
impl<S, V, E> !Sync for DefaultPillarSelector<S, V, E>
impl<S, V, E> Unpin for DefaultPillarSelector<S, V, E>where
E: Unpin,
impl<S, V, E> !UnwindSafe for DefaultPillarSelector<S, V, E>
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