Skip to main content

DynamicScalarVariableSlot

Struct DynamicScalarVariableSlot 

Source
pub struct DynamicScalarVariableSlot<S> {
    pub entity: EntityClassId,
    pub variable: VariableId,
    pub entity_type_name: &'static str,
    pub variable_name: &'static str,
    pub allows_unassigned: bool,
    /* private fields */
}
Expand description

Public dynamic scalar variable slot.

Fields§

§entity: EntityClassId

Logical entity class ID the slot is bound to.

§variable: VariableId

Logical variable ID the slot is bound to.

§entity_type_name: &'static str

Entity type name, checked against the SolutionDescriptor on resolution.

§variable_name: &'static str

Variable name, checked against the SolutionDescriptor on resolution.

§allows_unassigned: bool

Whether the variable may be unassigned (None).

Implementations§

Source§

impl<S> DynamicScalarVariableSlot<S>

Source

pub fn with_access( entity: EntityClassId, variable: VariableId, entity_type_name: &'static str, variable_name: &'static str, allows_unassigned: bool, access: Arc<dyn DynamicScalarAccess<S>>, ) -> Self

Creates an unresolved slot over a custom access implementation.

Source

pub fn resolve_descriptor_index( &mut self, descriptor: &SolutionDescriptor, ) -> Result<(), String>

Resolves this slot’s descriptor and variable indexes against descriptor.

Fails when the logical entity ID, entity type name, logical variable ID, variable name or variable kind do not match the descriptor, or when the slot was pre-bound to a different descriptor index.

Source

pub fn resolved_against( self, descriptor: &SolutionDescriptor, ) -> Result<Self, String>

Consuming form of resolve_descriptor_index.

Source

pub fn is_descriptor_resolved(&self) -> bool

Returns true once both the descriptor index and the variable index are resolved.

Source

pub fn descriptor_index(&self) -> usize

Index of this slot’s entity descriptor in the SolutionDescriptor.

§Panics

Panics if the slot has not been resolved against a SolutionDescriptor.

Source

pub fn descriptor_variable_index(&self) -> usize

Index of this slot’s variable within its entity descriptor.

§Panics

Panics if the slot has not been resolved against a SolutionDescriptor.

Source

pub fn matches_target( &self, entity_class: Option<&str>, variable_name: Option<&str>, ) -> bool

Returns true when this slot matches a configuration target; None for either name matches any entity class or variable.

Source

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

Number of rows of the bound entity class.

Source

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

Value on one row; None means unassigned.

Source

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

Assigns (Some) or unassigns (None) the value on one row.

Source

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

Candidate values for one row.

Source

pub fn has_nearby_value_candidates(&self) -> bool

Source

pub fn visit_nearby_value_candidates( &self, solution: &S, row: usize, limit: usize, visit: &mut dyn FnMut(usize), ) -> bool

Source

pub fn nearby_value_distance( &self, solution: &S, row: usize, candidate: usize, ) -> Option<f64>

Source

pub fn has_nearby_entity_candidates(&self) -> bool

Source

pub fn visit_nearby_entity_candidates( &self, solution: &S, left_row: usize, limit: usize, visit: &mut dyn FnMut(usize), ) -> bool

Source

pub fn nearby_entity_distance( &self, solution: &S, left_row: usize, right_row: usize, ) -> Option<f64>

Returns true when value is legal on the row; None is legal exactly when the slot allows unassigned values.

Source§

impl<S> DynamicScalarVariableSlot<S>

Source

pub fn new( entity: EntityClassId, variable: VariableId, entity_type_name: &'static str, variable_name: &'static str, allows_unassigned: bool, ) -> Self

Creates a slot whose access is the model backend itself.

Trait Implementations§

Source§

impl<S> Clone for DynamicScalarVariableSlot<S>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<S> Debug for DynamicScalarVariableSlot<S>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<S> Eq for DynamicScalarVariableSlot<S>

Source§

impl<S> PartialEq for DynamicScalarVariableSlot<S>

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.