Skip to main content

ProblemFact

Trait ProblemFact 

Source
pub trait ProblemFact:
    Clone
    + Send
    + Sync
    + Any
    + 'static {
    // Required method
    fn as_any(&self) -> &dyn Any;
}
Expand description

Marker trait for problem facts.

Problem facts are immutable input data that define the problem. They are used by constraints but not changed during solving.

§Example

use std::any::Any;
use solverforge_core::ProblemFact;

#[derive(Clone)]
struct Room {
    id: i64,
    capacity: usize,
}

impl ProblemFact for Room {
    fn as_any(&self) -> &dyn Any { self }
}

Required Methods§

Source

fn as_any(&self) -> &dyn Any

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§