fn apply(
        &self,
        context: &mut Context,
    ) -> TractResult<(bool, Vec<Box<dyn Rule<'rules> + 'rules>>)> {
        let values: Vec<T> =
            self.items.iter().map(|it| it.get(context)).collect::<TractResult<Vec<T>>>()?;
        let concrete: Vec<_> = values.iter().filter_map(|it| it.concretize()).collect();

        if concrete.len() == self.items.len() {
            trace!("    Given all rule: {:?} is {:?}", self.items, values);
            // We create a new solver instance, which will be populated with
            // new rules by the code inside the closure.
            let mut solver = Solver::default();
            (self.closure)(&mut solver, concrete)?;
            Ok((true, solver.take_rules()))
        } else {
            Ok((false, vec![]))
        }
    }
/// Tries to apply the rule to a given context.
Tries to apply the rule to a given context.
Tries to apply the rule to a given context .
fn apply(
        &self,
        context: &mut Context,
    ) -> TractResult<(bool, Vec<Box<dyn Rule<'rules> + 'rules>>)> {
        let values: Vec<T> =
            self.items.iter().map(|it| it.get(context)).collect::<TractResult<Vec<T>>>()?;
        let concrete: Vec<_> = values.iter().filter_map(|it| it.concretize()).collect();
        if concrete.len() == self.items.len() {
            trace!("    Given all rule: {:?} is {:?}", self.items, values);
            // We create a new solver instance, which will be populated with
            // new rules by the code inside the closure.
            let mut solver = Solver::default();
            (self.closure)(&mut solver, concrete)?;
            Ok((true, solver.take_rules()))
        } else {
            Ok((false, vec![]))
        }
    }
fn apply ( & self , context : & mut Context , ) -> TractResult < ( bool , Vec < Box < dyn Rule < ' rules > + ' rules > > ) > { let values : Vec < T > = self . items . iter ( ) . map ( | it | it . get ( context ) ) . collect :: < TractResult < Vec < T > > > ( ) ? ; let concrete : Vec < _ > = values . iter ( ) . filter_map ( | it | it . concretize ( ) ) . collect ( ) ; if concrete . len ( ) == self . items . len ( ) { trace ! ( " " self items values ) ; // We create a new solver instance, which will be populated with // new rules by the code inside the closure. let mut solver = Solver :: default ( ) ; ( self . closure ) ( & mut solver , concrete ) ? ; Ok ( ( true , solver . take_rules ( ) ) ) } else { Ok ( ( false , vec ! [ ] ) ) } }
Tries to apply the rule to a given context.
Tries to apply the rule to a given context .
&self
context
&mut Context
&self
context
&mut Context