fn apply(
        &self,
        context: &mut Context,
    ) -> TractResult<(bool, Vec<Box<dyn Rule<'rules> + 'rules>>)> {
        let value = self.item.get(context)?;

        if let Some(value) = value.concretize() {
            trace!("    Given rule: {:?} is {:?}", self.item, value);
            // 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, value)?;

            Ok((true, solver.take_rules()))
        } else {
            trace!(
                "In {:?}, failed to convert {:?} to expected type",
                self,
                self.item.get(context)?.wrap()
            );
            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 value = self.item.get(context)?;
        if let Some(value) = value.concretize() {
            trace!("    Given rule: {:?} is {:?}", self.item, value);
            // 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, value)?;
            Ok((true, solver.take_rules()))
        } else {
            trace!(
                "In {:?}, failed to convert {:?} to expected type",
                self,
                self.item.get(context)?.wrap()
            );
            Ok((false, vec![]))
        }
    }
fn apply ( & self , context : & mut Context , ) -> TractResult < ( bool , Vec < Box < dyn Rule < ' rules > + ' rules > > ) > { let value = self . item . get ( context ) ? ; if let Some ( value ) = value . concretize ( ) { trace ! ( " " self item value ) ; // 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 , value ) ? ; Ok ( ( true , solver . take_rules ( ) ) ) } else { trace ! ( " " self self item get ( context ) wrap ( ) ) ; 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