Skip to main content

DynamicModelBackend

Trait DynamicModelBackend 

Source
pub trait DynamicModelBackend:
    Clone
    + Send
    + Sync
    + 'static {
    type Score: Score;

    // Required methods
    fn entity_count(&self, entity: EntityClassId) -> usize;
    fn get_scalar(
        &self,
        entity: EntityClassId,
        row: usize,
        variable: VariableId,
    ) -> Option<usize>;
    fn set_scalar(
        &mut self,
        entity: EntityClassId,
        row: usize,
        variable: VariableId,
        value: Option<usize>,
    );
    fn list_len(
        &self,
        entity: EntityClassId,
        row: usize,
        variable: VariableId,
    ) -> usize;
    fn list_get(
        &self,
        entity: EntityClassId,
        row: usize,
        variable: VariableId,
        pos: usize,
    ) -> Option<usize>;
    fn list_insert(
        &mut self,
        entity: EntityClassId,
        row: usize,
        variable: VariableId,
        pos: usize,
        value: usize,
    );
    fn list_remove(
        &mut self,
        entity: EntityClassId,
        row: usize,
        variable: VariableId,
        pos: usize,
    ) -> Option<usize>;
    fn candidate_values(
        &self,
        entity: EntityClassId,
        row: usize,
        variable: VariableId,
    ) -> &[usize];

    // Provided methods
    fn list_element_count(
        &self,
        _entity: EntityClassId,
        _variable: VariableId,
    ) -> usize { ... }
    fn list_element(
        &self,
        _entity: EntityClassId,
        _variable: VariableId,
        element_index: usize,
    ) -> Option<usize> { ... }
    fn list_assigned_elements(
        &self,
        _entity: EntityClassId,
        _variable: VariableId,
    ) -> Vec<usize> { ... }
}
Expand description

Rust-owned dynamic planning model backend.

Binding crates implement this trait on their concrete dynamic solution state. The trait is expressed in logical entity and variable IDs rather than Rust TypeIds.

Required Associated Types§

Required Methods§

Source

fn entity_count(&self, entity: EntityClassId) -> usize

Source

fn get_scalar( &self, entity: EntityClassId, row: usize, variable: VariableId, ) -> Option<usize>

Source

fn set_scalar( &mut self, entity: EntityClassId, row: usize, variable: VariableId, value: Option<usize>, )

Source

fn list_len( &self, entity: EntityClassId, row: usize, variable: VariableId, ) -> usize

Source

fn list_get( &self, entity: EntityClassId, row: usize, variable: VariableId, pos: usize, ) -> Option<usize>

Source

fn list_insert( &mut self, entity: EntityClassId, row: usize, variable: VariableId, pos: usize, value: usize, )

Source

fn list_remove( &mut self, entity: EntityClassId, row: usize, variable: VariableId, pos: usize, ) -> Option<usize>

Source

fn candidate_values( &self, entity: EntityClassId, row: usize, variable: VariableId, ) -> &[usize]

Provided Methods§

Source

fn list_element_count( &self, _entity: EntityClassId, _variable: VariableId, ) -> usize

Source

fn list_element( &self, _entity: EntityClassId, _variable: VariableId, element_index: usize, ) -> Option<usize>

Source

fn list_assigned_elements( &self, _entity: EntityClassId, _variable: VariableId, ) -> Vec<usize>

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§