pub trait Problem {
type Error;
// Required methods
fn direct_dependencies<'life0, 'life1, 'async_trait>(
&'life0 self,
id: FragmentId,
dependecies: &'life1 mut Vec<FragmentId>,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn evaluate<'life0, 'async_trait>(
&'life0 self,
id: FragmentId,
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}
Expand description
Trait implemented by objects that define a specific problem to be solved by the Solver
.
Use async_trait
to implement this trait.
Required Associated Types§
Sourcetype Error
type Error
Error type for Problem::evaluate
.
Required Methods§
Sourcefn direct_dependencies<'life0, 'life1, 'async_trait>(
&'life0 self,
id: FragmentId,
dependecies: &'life1 mut Vec<FragmentId>,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn direct_dependencies<'life0, 'life1, 'async_trait>(
&'life0 self,
id: FragmentId,
dependecies: &'life1 mut Vec<FragmentId>,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Fill dependencies
with the direct dependencies of id
. The output vector is guaranteed
to be empty when this method is called.
Sourcefn evaluate<'life0, 'async_trait>(
&'life0 self,
id: FragmentId,
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn evaluate<'life0, 'async_trait>(
&'life0 self,
id: FragmentId,
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Called by the solver to signal that a fragment has had all of its dependencies evaluated. Thus, the fragment should be evaluated too.
See Solver::run
and Solver::step
on how evaluation failures are handled.
This method is never called more than once with the same fragment.