pub struct PillarChangeMove<S, V> { /* private fields */ }Expand description
A move that assigns a value to all entities in a pillar.
Stores entity 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> PillarChangeMove<S, V>
impl<S, V> PillarChangeMove<S, V>
Sourcepub fn new(
entity_indices: Vec<usize>,
to_value: Option<V>,
getter: fn(&S, usize) -> Option<V>,
setter: fn(&mut S, usize, Option<V>),
variable_name: &'static str,
descriptor_index: usize,
) -> Self
pub fn new( entity_indices: Vec<usize>, to_value: Option<V>, 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 change move with typed function pointers.
§Arguments
entity_indices- Indices of entities in the pillarto_value- The new value to assign to all entitiesgetter- Typed getter function pointersetter- Typed setter function pointervariable_name- Name of the variable being changeddescriptor_index- Index in the entity descriptor
Sourcepub fn pillar_size(&self) -> usize
pub fn pillar_size(&self) -> usize
Returns the pillar size.
Trait Implementations§
Source§impl<S: Clone, V: Clone> Clone for PillarChangeMove<S, V>
impl<S: Clone, V: Clone> Clone for PillarChangeMove<S, V>
Source§fn clone(&self) -> PillarChangeMove<S, V>
fn clone(&self) -> PillarChangeMove<S, V>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<S, V: Debug> Debug for PillarChangeMove<S, V>
impl<S, V: Debug> Debug for PillarChangeMove<S, V>
Source§impl<S, V> Move<S> for PillarChangeMove<S, V>
impl<S, V> Move<S> for PillarChangeMove<S, V>
Source§fn is_doable(&self, score_director: &dyn ScoreDirector<S>) -> bool
fn is_doable(&self, score_director: &dyn ScoreDirector<S>) -> bool
Returns true if this move can be executed in the current state. Read more
Source§fn do_move(&self, score_director: &mut dyn ScoreDirector<S>)
fn do_move(&self, score_director: &mut dyn ScoreDirector<S>)
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 PillarChangeMove<S, V>where
V: Freeze,
impl<S, V> RefUnwindSafe for PillarChangeMove<S, V>where
V: RefUnwindSafe,
S: RefUnwindSafe,
impl<S, V> Send for PillarChangeMove<S, V>
impl<S, V> Sync for PillarChangeMove<S, V>
impl<S, V> Unpin for PillarChangeMove<S, V>
impl<S, V> UnwindSafe for PillarChangeMove<S, V>where
V: UnwindSafe,
S: UnwindSafe,
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