Solvable

Trait Solvable 

Source
pub trait Solvable:
    PlanningSolution
    + Send
    + 'static {
    // Required method
    fn solve(
        self,
        terminate: Option<&AtomicBool>,
        sender: UnboundedSender<(Self, Self::Score)>,
    );
}
Expand description

Trait for solutions that can be solved with channel-based solution streaming.

This trait is implemented by the #[planning_solution] macro when constraints is specified. The solver sends owned solutions through the channel - no Clone required.

Solver progress is logged via tracing at INFO/DEBUG levels.

§Type Parameters

The solution must be Send + 'static to support async job execution. Note: Clone is NOT required - ownership is transferred via channel.

Required Methods§

Source

fn solve( self, terminate: Option<&AtomicBool>, sender: UnboundedSender<(Self, Self::Score)>, )

Solves the solution, sending each new best through the channel.

The final solution is sent through the channel before this returns. Ownership of solutions transfers through the channel.

§Arguments
  • terminate - Optional flag to request early termination
  • sender - Channel to send each new best solution (ownership transferred)

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§