pub struct DefaultPillarSelector<S, V, ES, E>where
S: PlanningSolution,
V: Clone + Eq + Hash + Send + Sync + 'static,
ES: EntitySelector<S>,
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
Both the entity selector ES and the extractor function E are stored as
concrete generic type parameters, eliminating all virtual dispatch overhead.
Note: The value extractor closure uses &dyn ScoreDirector<S> intentionally.
This is a scorer-agnostic boundary - the closure doesn’t need the concrete D type.
Implementations§
Source§impl<S, V, ES, E> DefaultPillarSelector<S, V, ES, E>where
S: PlanningSolution,
V: Clone + Eq + Hash + Send + Sync + 'static,
ES: EntitySelector<S>,
E: Fn(&dyn ScoreDirector<S>, usize, usize) -> Option<V> + Send + Sync,
impl<S, V, ES, E> DefaultPillarSelector<S, V, ES, E>where
S: PlanningSolution,
V: Clone + Eq + Hash + Send + Sync + 'static,
ES: EntitySelector<S>,
E: Fn(&dyn ScoreDirector<S>, usize, usize) -> Option<V> + Send + Sync,
Sourcepub fn new(
entity_selector: ES,
descriptor_index: usize,
variable_name: &'static str,
value_extractor: E,
) -> Self
pub fn new( entity_selector: ES, 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, ES, E> Debug for DefaultPillarSelector<S, V, ES, E>where
S: PlanningSolution,
V: Clone + Eq + Hash + Send + Sync + 'static,
ES: EntitySelector<S> + Debug,
E: Fn(&dyn ScoreDirector<S>, usize, usize) -> Option<V> + Send + Sync,
impl<S, V, ES, E> Debug for DefaultPillarSelector<S, V, ES, E>where
S: PlanningSolution,
V: Clone + Eq + Hash + Send + Sync + 'static,
ES: EntitySelector<S> + Debug,
E: Fn(&dyn ScoreDirector<S>, usize, usize) -> Option<V> + Send + Sync,
Source§impl<S, V, ES, E> PillarSelector<S> for DefaultPillarSelector<S, V, ES, E>where
S: PlanningSolution,
V: Clone + Eq + Hash + Send + Sync + 'static,
ES: EntitySelector<S>,
E: Fn(&dyn ScoreDirector<S>, usize, usize) -> Option<V> + Send + Sync,
impl<S, V, ES, E> PillarSelector<S> for DefaultPillarSelector<S, V, ES, E>where
S: PlanningSolution,
V: Clone + Eq + Hash + Send + Sync + 'static,
ES: EntitySelector<S>,
E: Fn(&dyn ScoreDirector<S>, usize, usize) -> Option<V> + Send + Sync,
Source§fn iter<'a, D: ScoreDirector<S>>(
&'a self,
score_director: &'a D,
) -> Box<dyn Iterator<Item = Pillar> + 'a>
fn iter<'a, D: ScoreDirector<S>>( &'a self, score_director: &'a D, ) -> Box<dyn Iterator<Item = Pillar> + 'a>
Returns an iterator over pillars. Read more
Source§fn size<D: ScoreDirector<S>>(&self, score_director: &D) -> usize
fn size<D: ScoreDirector<S>>(&self, score_director: &D) -> 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, ES, E> Freeze for DefaultPillarSelector<S, V, ES, E>
impl<S, V, ES, E> RefUnwindSafe for DefaultPillarSelector<S, V, ES, E>
impl<S, V, ES, E> Send for DefaultPillarSelector<S, V, ES, E>
impl<S, V, ES, E> Sync for DefaultPillarSelector<S, V, ES, E>where
ES: Sync,
impl<S, V, ES, E> Unpin for DefaultPillarSelector<S, V, ES, E>
impl<S, V, ES, E> UnwindSafe for DefaultPillarSelector<S, V, ES, 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
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>
Converts
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>
Converts
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