pub fn run(
        &'script self,
        context: &'run crate::EventContext,
        aggr: AggrType,
        event: &'run mut Value<'event>,
        state: &'run mut Value<'static>,
        meta: &'run mut Value<'event>,
    ) -> Result<Return<'event>> {
        let mut local = LocalStack::with_size(self.locals);

        let mut exprs = self.exprs.iter().peekable();
        let opts = ExecOpts {
            result_needed: true,
            aggr,
        };

        let env = Env {
            context,
            consts: &self.consts,
            aggrs: &self.aggregates,
            meta: &self.node_meta,
            recursion_limit: crate::recursion_limit(),
        };

        while let Some(expr) = exprs.next() {
            if exprs.peek().is_none() {
                match stry!(expr.run(opts.with_result(), &env, event, state, meta, &mut local)) {
                    Cont::Drop => return Ok(Return::Drop),
                    Cont::Emit(value, port) => return Ok(Return::Emit { value, port }),
                    Cont::EmitEvent(port) => {
                        return Ok(Return::EmitEvent { port });
                    }
                    Cont::Cont(v) => {
                        return Ok(Return::Emit {
                            value: v.into_owned(),
                            port: None,
                        })
                    }
                }
            } else {
                match stry!(expr.run(opts.without_result(), &env, event, state, meta, &mut local)) {
                    Cont::Drop => return Ok(Return::Drop),
                    Cont::Emit(value, port) => return Ok(Return::Emit { value, port }),
                    Cont::EmitEvent(port) => {
                        return Ok(Return::EmitEvent { port });
                    }
                    Cont::Cont(_v) => (),
                }
            }
        }

        // We know that we never get here, sadly rust doesn't
        #[cfg_attr(tarpaulin, skip)]
        Ok(Return::Emit {
            value: Value::null(),
            port: None,
        })
    }
/// Runs the script and evaluates to a resulting event
Runs the script and evaluates to a resulting event
Runs the script and evaluates to a resulting event
pub fn run(
        &'script self,
        context: &'run crate::EventContext,
        aggr: AggrType,
        event: &'run mut Value<'event>,
        state: &'run mut Value<'static>,
        meta: &'run mut Value<'event>,
    ) -> Result<Return<'event>> {
        let mut local = LocalStack::with_size(self.locals);
        let mut exprs = self.exprs.iter().peekable();
        let opts = ExecOpts {
            result_needed: true,
            aggr,
        };
        let env = Env {
            context,
            consts: &self.consts,
            aggrs: &self.aggregates,
            meta: &self.node_meta,
            recursion_limit: crate::recursion_limit(),
        };
        while let Some(expr) = exprs.next() {
            if exprs.peek().is_none() {
                match stry!(expr.run(opts.with_result(), &env, event, state, meta, &mut local)) {
                    Cont::Drop => return Ok(Return::Drop),
                    Cont::Emit(value, port) => return Ok(Return::Emit { value, port }),
                    Cont::EmitEvent(port) => {
                        return Ok(Return::EmitEvent { port });
                    }
                    Cont::Cont(v) => {
                        return Ok(Return::Emit {
                            value: v.into_owned(),
                            port: None,
                        })
                    }
                }
            } else {
                match stry!(expr.run(opts.without_result(), &env, event, state, meta, &mut local)) {
                    Cont::Drop => return Ok(Return::Drop),
                    Cont::Emit(value, port) => return Ok(Return::Emit { value, port }),
                    Cont::EmitEvent(port) => {
                        return Ok(Return::EmitEvent { port });
                    }
                    Cont::Cont(_v) => (),
                }
            }
        }
        // We know that we never get here, sadly rust doesn't
        #[cfg_attr(tarpaulin, skip)]
        Ok(Return::Emit {
            value: Value::null(),
            port: None,
        })
    }
pub fn run ( & ' script self , context : & ' run crate :: EventContext , aggr : AggrType , event : & ' run mut Value < ' event > , state : & ' run mut Value < ' static > , meta : & ' run mut Value < ' event > , ) -> Result < Return < ' event > > { let mut local = LocalStack :: with_size ( self . locals ) ; let mut exprs = self . exprs . iter ( ) . peekable ( ) ; let opts = ExecOpts { result_needed : true , aggr , } ; let env = Env { context , consts : & self . consts , aggrs : & self . aggregates , meta : & self . node_meta , recursion_limit : crate :: recursion_limit ( ) , } ; while let Some ( expr ) = exprs . next ( ) { if exprs . peek ( ) . is_none ( ) { match stry ! ( expr run ( opts with_result ( ) env event state meta mut local ) ) { Cont :: Drop => return Ok ( Return :: Drop ) , Cont :: Emit ( value , port ) => return Ok ( Return :: Emit { value , port } ) , Cont :: EmitEvent ( port ) => { return Ok ( Return :: EmitEvent { port } ) ; } Cont :: Cont ( v ) => { return Ok ( Return :: Emit { value : v . into_owned ( ) , port : None , } ) } } } else { match stry ! ( expr run ( opts without_result ( ) env event state meta mut local ) ) { Cont :: Drop => return Ok ( Return :: Drop ) , Cont :: Emit ( value , port ) => return Ok ( Return :: Emit { value , port } ) , Cont :: EmitEvent ( port ) => { return Ok ( Return :: EmitEvent { port } ) ; } Cont :: Cont ( _v ) => ( ) , } } } // We know that we never get here, sadly rust doesn't # [ cfg_attr ( tarpaulin skip ) ] Ok ( Return :: Emit { value : Value :: null ( ) , port : None , } ) }
Runs the script and evaluates to a resulting event
Runs the script and evaluates to a resulting event
&'script self
context
&'run crate::EventContext
aggr
AggrType
event
&'run mut Value<'event>
state
&'run mut Value<'static>
meta
&'run mut Value<'event>
&'script self
context
&'run crate::EventContext
aggr
AggrType
event
&'run mut Value<'event>
state
&'run mut Value<'static>
meta
&'run mut Value<'event>