Skip to main content

DynamicScalarAccess

Trait DynamicScalarAccess 

Source
pub trait DynamicScalarAccess<S>: Send + Sync {
Show 13 methods // Required methods fn entity_class(&self) -> EntityClassId; fn variable(&self) -> VariableId; fn entity_count(&self, solution: &S) -> usize; fn get(&self, solution: &S, row: usize) -> Option<usize>; fn set(&self, solution: &mut S, row: usize, value: Option<usize>); fn candidate_values<'a>(&self, solution: &'a S, row: usize) -> &'a [usize]; fn value_is_legal(&self, solution: &S, row: usize, value: usize) -> bool; // Provided methods fn has_nearby_value_candidates(&self) -> bool { ... } fn visit_nearby_value_candidates( &self, _solution: &S, _row: usize, _limit: usize, _visit: &mut dyn FnMut(usize), ) -> bool { ... } fn nearby_value_distance( &self, _solution: &S, _row: usize, _candidate: usize, ) -> Option<f64> { ... } fn has_nearby_entity_candidates(&self) -> bool { ... } fn visit_nearby_entity_candidates( &self, _solution: &S, _left_row: usize, _limit: usize, _visit: &mut dyn FnMut(usize), ) -> bool { ... } fn nearby_entity_distance( &self, _solution: &S, _left_row: usize, _right_row: usize, ) -> Option<f64> { ... }
}
Expand description

Object-safe dynamic scalar variable access.

Required Methods§

Source

fn entity_class(&self) -> EntityClassId

Source

fn variable(&self) -> VariableId

Source

fn entity_count(&self, solution: &S) -> usize

Source

fn get(&self, solution: &S, row: usize) -> Option<usize>

Source

fn set(&self, solution: &mut S, row: usize, value: Option<usize>)

Source

fn candidate_values<'a>(&self, solution: &'a S, row: usize) -> &'a [usize]

Provided Methods§

Source

fn has_nearby_value_candidates(&self) -> bool

Whether this slot structurally supplies an ordered nearby-value source.

This reports schema capability rather than a row result. The runtime still calls Self::visit_nearby_value_candidates for each row, since a row-local source or callback may intentionally be absent for one row.

Source

fn visit_nearby_value_candidates( &self, _solution: &S, _row: usize, _limit: usize, _visit: &mut dyn FnMut(usize), ) -> bool

Visits the ordered nearby-value source for one row.

limit is a source-consumption limit, not a result limit. Implementors that bridge lazy host-language iterables must not consume values after that limit. Return true when this row supplied a source, including an empty source. Return false when no row source is available so the solver can use the ordinary candidate-value fallback.

Source

fn nearby_value_distance( &self, _solution: &S, _row: usize, _candidate: usize, ) -> Option<f64>

Returns the nearby-value distance for a source candidate when one is available. None preserves source order as the distance fallback.

Source

fn has_nearby_entity_candidates(&self) -> bool

Whether this slot structurally supplies an ordered nearby-entity source.

Source

fn visit_nearby_entity_candidates( &self, _solution: &S, _left_row: usize, _limit: usize, _visit: &mut dyn FnMut(usize), ) -> bool

Visits the ordered nearby-entity source for one left-hand row.

limit has the same source-consumption contract as Self::visit_nearby_value_candidates. Return true when a row source was supplied, including an empty source; otherwise return false to request the all-entity fallback.

Source

fn nearby_entity_distance( &self, _solution: &S, _left_row: usize, _right_row: usize, ) -> Option<f64>

Returns the nearby-entity distance for a source candidate when one is available. None preserves source order as the distance fallback.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§