pub struct PillarSwapMove<S, V> { /* private fields */ }Expand description
A move that swaps values between two pillars.
Stores pillar indices and concrete function pointers for zero-erasure access.
do_move returns the previous pillar values as typed undo data.
§Type Parameters
S- The planning solution typeV- The variable value type
Implementations§
Source§impl<S, V> PillarSwapMove<S, V>
impl<S, V> PillarSwapMove<S, V>
Sourcepub fn new(
left_indices: Vec<usize>,
right_indices: Vec<usize>,
getter: fn(&S, usize, usize) -> Option<V>,
setter: fn(&mut S, usize, usize, Option<V>),
variable_index: usize,
variable_name: &'static str,
descriptor_index: usize,
) -> Self
pub fn new( left_indices: Vec<usize>, right_indices: Vec<usize>, getter: fn(&S, usize, usize) -> Option<V>, setter: fn(&mut S, usize, usize, Option<V>), variable_index: usize, variable_name: &'static str, descriptor_index: usize, ) -> Self
Creates a new pillar swap move with concrete function pointers.
§Arguments
left_indices- Indices of entities in the left pillarright_indices- Indices of entities in the right pillargetter- Concrete getter function pointersetter- Concrete setter function pointervariable_name- Name of the variable being swappeddescriptor_index- Index in the entity descriptor
pub fn left_indices(&self) -> &[usize]
pub fn right_indices(&self) -> &[usize]
Trait Implementations§
Source§impl<S, V: Debug> Debug for PillarSwapMove<S, V>
impl<S, V: Debug> Debug for PillarSwapMove<S, V>
Source§impl<S, V> Move<S> for PillarSwapMove<S, V>
impl<S, V> Move<S> for PillarSwapMove<S, V>
Source§fn for_each_affected_entity<W: FnMut(MoveAffectedEntity<'_>)>(
&self,
visitor: &mut W,
)
fn for_each_affected_entity<W: FnMut(MoveAffectedEntity<'_>)>( &self, visitor: &mut W, )
A pillar swap mutates BOTH halves. entity_indices() exposes the left
pillar as its primary slice, so the trait default would hide every
right-pillar entity from pin checks, tabu bookkeeping, and telemetry.
type Undo = (Vec<(usize, Option<V>)>, Vec<(usize, Option<V>)>)
fn is_doable<D: Director<S>>(&self, score_director: &D) -> bool
fn do_move<D: Director<S>>(&self, score_director: &mut D) -> Self::Undo
fn undo_move<D: Director<S>>(&self, score_director: &mut D, undo: Self::Undo)
fn descriptor_index(&self) -> usize
fn entity_indices(&self) -> &[usize]
fn variable_name(&self) -> &str
fn tabu_signature<D: Director<S>>( &self, score_director: &D, ) -> Cow<'_, MoveTabuSignature>
fn do_move_with_scratch<D: Director<S>>( &self, score_director: &mut D, journal_pool: &mut Vec<Self::Undo>, ) -> Self::Undo
fn undo_move_with_scratch<D: Director<S>>( &self, score_director: &mut D, undo: Self::Undo, journal_pool: &mut Vec<Self::Undo>, )
fn is_doable_with_working_preview<D: Director<S>>( &self, score_director: &mut D, ) -> bool
fn telemetry_label(&self) -> &'static str
fn requires_hard_improvement(&self) -> bool
fn requires_score_improvement(&self) -> bool
Source§fn candidate_trace_identity(&self) -> Option<CandidateTraceIdentity>
fn candidate_trace_identity(&self) -> Option<CandidateTraceIdentity>
Returns the canonical identity used by opt-in candidate-pull tracing. Read more
Auto Trait Implementations§
impl<S, V> Freeze for PillarSwapMove<S, V>
impl<S, V> RefUnwindSafe for PillarSwapMove<S, V>
impl<S, V> Send for PillarSwapMove<S, V>
impl<S, V> Sync for PillarSwapMove<S, V>
impl<S, V> Unpin for PillarSwapMove<S, V>
impl<S, V> UnsafeUnpin for PillarSwapMove<S, V>
impl<S, V> UnwindSafe for PillarSwapMove<S, V>
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