Skip to main content

MoveCursor

Trait MoveCursor 

Source
pub trait MoveCursor<S: PlanningSolution, M: Move<S>> {
    // Required methods
    fn next_candidate(&mut self) -> Option<CandidateId>;
    fn candidate(&self, id: CandidateId) -> Option<MoveCandidateRef<'_, S, M>>;
    fn take_candidate(&mut self, id: CandidateId) -> M;

    // Provided methods
    fn next_owned_candidate(&mut self) -> Option<M> { ... }
    fn next_owned_candidate_matching(
        &mut self,
        predicate: for<'a> fn(MoveCandidateRef<'a, S, M>) -> bool,
    ) -> Option<M> { ... }
    fn next_owned_candidate_inspected<T, F>(
        &mut self,
        inspect: F,
    ) -> Option<(M, T)>
       where F: for<'a> FnMut(MoveCandidateRef<'a, S, M>) -> Option<T> { ... }
    fn apply_owned_candidate<D: Director<S>>(
        &mut self,
        id: CandidateId,
        score_director: &mut D,
    ) { ... }
    fn release_candidate(&mut self, id: CandidateId) -> bool { ... }
    fn selector_index(&self, _id: CandidateId) -> Option<usize> { ... }
}
Expand description

Incremental, cursor-owned candidate storage for a single neighborhood.

next_candidate() constructs or discovers at most the next candidate and returns a stable ID. A consumer may stop at any time: dropping the cursor must release all retained candidates and any unconsumed source state without requiring the remaining neighborhood to be enumerated. Implementations must not rely on full exhaustion for correctness, callback delivery, or cleanup.

Candidates remain borrowable until they are released or transferred. The selected candidate is consumed exactly once through take_candidate() or apply_owned_candidate(); unselected live candidates remain cursor-owned.

Required Methods§

Provided Methods§

Source

fn next_owned_candidate(&mut self) -> Option<M>

Source

fn next_owned_candidate_matching( &mut self, predicate: for<'a> fn(MoveCandidateRef<'a, S, M>) -> bool, ) -> Option<M>

Source

fn next_owned_candidate_inspected<T, F>(&mut self, inspect: F) -> Option<(M, T)>
where F: for<'a> FnMut(MoveCandidateRef<'a, S, M>) -> Option<T>,

Source

fn apply_owned_candidate<D: Director<S>>( &mut self, id: CandidateId, score_director: &mut D, )

Source

fn release_candidate(&mut self, id: CandidateId) -> bool

Source

fn selector_index(&self, _id: CandidateId) -> Option<usize>

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<S, M> MoveCursor<S, M> for ArenaMoveCursor<S, M>
where S: PlanningSolution, M: Move<S>,

Source§

impl<S, V, D> MoveCursor<S, ListChangeMove<S, V>> for NearbyListChangeMoveCursor<'_, S, V, D>
where S: PlanningSolution, V: Clone + PartialEq + Send + Sync + Debug + 'static, D: CrossEntityDistanceMeter<S>,

Source§

impl<S, V, D> MoveCursor<S, ListSwapMove<S, V>> for NearbyListSwapMoveCursor<'_, S, V, D>
where S: PlanningSolution, V: Clone + PartialEq + Send + Sync + Debug + 'static, D: CrossEntityDistanceMeter<S>,

Source§

impl<S, V> MoveCursor<S, ChangeMove<S, V>> for ChangeMoveCursor<S, V>
where S: PlanningSolution, V: Clone + PartialEq + Send + Sync + Debug + 'static,

Source§

impl<S, V> MoveCursor<S, ListChangeMove<S, V>> for ListChangeMoveCursor<S, V>
where S: PlanningSolution, V: Clone + PartialEq + Send + Sync + Debug + 'static,

Source§

impl<S, V> MoveCursor<S, ListMoveUnion<S, V>> for ListPrecedenceMoveCursor<S, V>
where S: PlanningSolution, V: Clone + PartialEq + Send + Sync + Debug + 'static,

Source§

impl<S, V> MoveCursor<S, ListPermuteMove<S, V>> for ListPermuteMoveCursor<S, V>
where S: PlanningSolution, V: Clone + Send + Sync + Debug + 'static,

Source§

impl<S, V> MoveCursor<S, ListReverseMove<S, V>> for ListReverseMoveCursor<S, V>
where S: PlanningSolution, V: Clone + Send + Sync + Debug + 'static,

Source§

impl<S, V> MoveCursor<S, ListRuinMove<S, V>> for ListRuinMoveCursor<S, V>
where S: PlanningSolution, V: Clone + PartialEq + Send + Sync + Debug + 'static,

Source§

impl<S, V> MoveCursor<S, ListSwapMove<S, V>> for ListSwapMoveCursor<S, V>
where S: PlanningSolution, V: Clone + PartialEq + Send + Sync + Debug + 'static,

Source§

impl<S, V> MoveCursor<S, RuinMove<S, V>> for RuinMoveCursor<S, V>
where S: PlanningSolution, V: Clone + Send + Sync + Debug + 'static,

Source§

impl<S, V> MoveCursor<S, SublistChangeMove<S, V>> for SublistChangeMoveCursor<S, V>
where S: PlanningSolution, V: Clone + PartialEq + Send + Sync + Debug + 'static,

Source§

impl<S, V> MoveCursor<S, SublistSwapMove<S, V>> for SublistSwapMoveCursor<S, V>
where S: PlanningSolution, V: Clone + PartialEq + Send + Sync + Debug + 'static,

Source§

impl<S, V> MoveCursor<S, SwapMove<S, V>> for SwapMoveCursor<S, V>
where S: PlanningSolution, V: Clone + PartialEq + Send + Sync + Debug + 'static,

Source§

impl<S> MoveCursor<S, DynamicListChangeMove<S>> for DynamicListChangeMoveCursor<S>