pub trait PlanningEntity:
Clone
+ Send
+ Sync
+ Any
+ 'static {
// Required methods
fn as_any(&self) -> &dyn Any;
fn as_any_mut(&mut self) -> &mut dyn Any;
// Provided method
fn is_pinned(&self) -> bool { ... }
}Expand description
Marker trait for planning entities.
A planning entity is something that gets planned/optimized. It contains one or more planning variables that the solver will change.
§Example
use std::any::Any;
use solverforge_core::PlanningEntity;
#[derive(Clone)]
struct Queen {
column: i32,
row: Option<i32>,
}
impl PlanningEntity for Queen {
fn as_any(&self) -> &dyn Any { self }
fn as_any_mut(&mut self) -> &mut dyn Any { self }
}For complex entities, use the #[derive(PlanningEntity)] macro from solverforge-macros.
§Pinning
Entities can be “pinned” to prevent the solver from changing them.
Override is_pinned() to return true for pinned entities.
Required Methods§
Provided Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".