pub struct DefaultProblemChangeDirector { /* private fields */ }Expand description
Default implementation of ProblemChangeDirector for local use.
This implementation tracks changes and maintains an index of working objects for lookup operations.
Implementations§
Source§impl DefaultProblemChangeDirector
impl DefaultProblemChangeDirector
Sourcepub fn new(solution: &Value, id_field: &str) -> Self
pub fn new(solution: &Value, id_field: &str) -> Self
Create a new director with the given working solution.
§Arguments
solution- The working solution JSONid_field- The field name used for object IDs (typically “id”)
Sourcepub fn changes(&self) -> &[ChangeRecord]
pub fn changes(&self) -> &[ChangeRecord]
Get the changes recorded by this director.
Sourcepub fn has_changes(&self) -> bool
pub fn has_changes(&self) -> bool
Check if any changes were made.
Sourcepub fn update_index(&mut self, id: String, value: Value)
pub fn update_index(&mut self, id: String, value: Value)
Update the object index with a new or modified object.
Sourcepub fn remove_from_index(&mut self, id: &str)
pub fn remove_from_index(&mut self, id: &str)
Remove an object from the index.
Trait Implementations§
Source§impl Debug for DefaultProblemChangeDirector
impl Debug for DefaultProblemChangeDirector
Source§impl ProblemChangeDirector for DefaultProblemChangeDirector
impl ProblemChangeDirector for DefaultProblemChangeDirector
Source§fn add_entity(
&mut self,
entity_id: &str,
entity: Value,
consumer: ChangeConsumer,
)
fn add_entity( &mut self, entity_id: &str, entity: Value, consumer: ChangeConsumer, )
Add a new planning entity to the solution. Read more
Source§fn remove_entity(&mut self, entity_id: &str, consumer: ChangeConsumer)
fn remove_entity(&mut self, entity_id: &str, consumer: ChangeConsumer)
Remove a planning entity from the solution. Read more
Source§fn change_variable(
&mut self,
entity_id: &str,
variable_name: &str,
consumer: ChangeConsumer,
)
fn change_variable( &mut self, entity_id: &str, variable_name: &str, consumer: ChangeConsumer, )
Change a planning variable on an entity. Read more
Source§fn add_problem_fact(
&mut self,
fact_id: &str,
fact: Value,
consumer: ChangeConsumer,
)
fn add_problem_fact( &mut self, fact_id: &str, fact: Value, consumer: ChangeConsumer, )
Add a new problem fact to the solution. Read more
Source§fn remove_problem_fact(&mut self, fact_id: &str, consumer: ChangeConsumer)
fn remove_problem_fact(&mut self, fact_id: &str, consumer: ChangeConsumer)
Remove a problem fact from the solution. Read more
Source§fn change_problem_property(&mut self, object_id: &str, consumer: ChangeConsumer)
fn change_problem_property(&mut self, object_id: &str, consumer: ChangeConsumer)
Change a property on an entity or problem fact. Read more
Source§fn look_up_working_object_or_fail(
&self,
external_id: &str,
) -> Result<Value, ProblemChangeError>
fn look_up_working_object_or_fail( &self, external_id: &str, ) -> Result<Value, ProblemChangeError>
Look up a working object by its external ID. Read more
Source§fn look_up_working_object(&self, external_id: &str) -> Option<Value>
fn look_up_working_object(&self, external_id: &str) -> Option<Value>
Look up a working object by its external ID. Read more
Source§fn update_shadow_variables(&mut self)
fn update_shadow_variables(&mut self)
Trigger variable listeners for changes made so far. Read more
Auto Trait Implementations§
impl Freeze for DefaultProblemChangeDirector
impl RefUnwindSafe for DefaultProblemChangeDirector
impl Send for DefaultProblemChangeDirector
impl Sync for DefaultProblemChangeDirector
impl Unpin for DefaultProblemChangeDirector
impl UnwindSafe for DefaultProblemChangeDirector
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