pub struct PillarSwapMove<S, V> { /* private fields */ }Expand description
A move that swaps values between two pillars.
Stores pillar indices and typed function pointers for zero-erasure access.
Undo is handled by RecordingScoreDirector, not by this move.
§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) -> Option<V>,
setter: fn(&mut S, usize, Option<V>),
variable_name: &'static str,
descriptor_index: usize,
) -> Self
pub fn new( left_indices: Vec<usize>, right_indices: Vec<usize>, getter: fn(&S, usize) -> Option<V>, setter: fn(&mut S, usize, Option<V>), variable_name: &'static str, descriptor_index: usize, ) -> Self
Creates a new pillar swap move with typed function pointers.
§Arguments
left_indices- Indices of entities in the left pillarright_indices- Indices of entities in the right pillargetter- Typed getter function pointersetter- Typed setter function pointervariable_name- Name of the variable being swappeddescriptor_index- Index in the entity descriptor
Sourcepub fn left_indices(&self) -> &[usize]
pub fn left_indices(&self) -> &[usize]
Returns the left pillar indices.
Sourcepub fn right_indices(&self) -> &[usize]
pub fn right_indices(&self) -> &[usize]
Returns the right pillar indices.
Trait Implementations§
Source§impl<S, V: Clone> Clone for PillarSwapMove<S, V>
impl<S, V: Clone> Clone for PillarSwapMove<S, V>
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 is_doable<D: ScoreDirector<S>>(&self, score_director: &D) -> bool
fn is_doable<D: ScoreDirector<S>>(&self, score_director: &D) -> bool
Returns true if this move can be executed in the current state. Read more
Source§fn do_move<D: ScoreDirector<S>>(&self, score_director: &mut D)
fn do_move<D: ScoreDirector<S>>(&self, score_director: &mut D)
Executes this move, modifying the working solution. Read more
Source§fn descriptor_index(&self) -> usize
fn descriptor_index(&self) -> usize
Returns the descriptor index of the entity type this move affects.
Source§fn entity_indices(&self) -> &[usize]
fn entity_indices(&self) -> &[usize]
Returns the entity indices involved in this move.
Source§fn variable_name(&self) -> &str
fn variable_name(&self) -> &str
Returns the variable name this move affects.
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> 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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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