PlanningId

Trait PlanningId 

Source
pub trait PlanningId {
    type Id: Eq + Hash + Clone + Send + Sync + 'static;

    // Required method
    fn planning_id(&self) -> Self::Id;
}
Expand description

Trait for unique identification of entities and facts.

Used for looking up working copies during solving and rebasing moves.

§Example

use solverforge_core::PlanningId;

#[derive(Clone)]
struct Task {
    id: i64,
    name: String,
}

impl PlanningId for Task {
    type Id = i64;
    fn planning_id(&self) -> i64 { self.id }
}

The ID type must be Eq + Hash + Clone.

Required Associated Types§

Source

type Id: Eq + Hash + Clone + Send + Sync + 'static

The type of the unique identifier.

Required Methods§

Source

fn planning_id(&self) -> Self::Id

Returns the unique identifier for this object.

This must never return a value that changes during solving.

Implementors§