pub fn observe_event(&mut self, event: &T) -> Result<(), Vec<String>> {
        let mut errs: Vec<String> = Vec::new();

        self.properties.iter_mut().for_each(|prop| {
            // Note that using iter_mut and wanting to step on the prop.answer value is not
            // possible, as prop.answer is of type &mut and step would "move out of it". The
            // solution is to use an auxiliary variable; exachange the value with a
            // placeholder then go on to step the state machine.
            let mut old_ans = PartialAnswer::Success;
            std::mem::swap(&mut prop.answer, &mut old_ans);
            match step(old_ans, event) {
                PartialAnswer::Failure(_) => errs.push(prop.label.clone()),
                x => prop.answer = x,
            }
        });

        if errs.is_empty() {
            Ok(())
        } else {
            Err(errs)
        }
    }
/// Feeds one event to every property under observation. Returns `Ok(())` if
/// no property under observation failed, otherwise it returns the list
/// of failed property labels.
Feeds one event to every property under observation. Returns `Ok(())` if
no property under observation failed, otherwise it returns the list
of failed property labels.
Feeds one event to every property under observation . Returns ` Ok (( )) ` if no property under observation failed otherwise it returns the list of failed property labels .
pub fn observe_event(&mut self, event: &T) -> Result<(), Vec<String>> {
        let mut errs: Vec<String> = Vec::new();
        self.properties.iter_mut().for_each(|prop| {
            // Note that using iter_mut and wanting to step on the prop.answer value is not
            // possible, as prop.answer is of type &mut and step would "move out of it". The
            // solution is to use an auxiliary variable; exachange the value with a
            // placeholder then go on to step the state machine.
            let mut old_ans = PartialAnswer::Success;
            std::mem::swap(&mut prop.answer, &mut old_ans);
            match step(old_ans, event) {
                PartialAnswer::Failure(_) => errs.push(prop.label.clone()),
                x => prop.answer = x,
            }
        });
        if errs.is_empty() {
            Ok(())
        } else {
            Err(errs)
        }
    }
pub fn observe_event ( & mut self , event : & T ) -> Result < ( ) , Vec < String > > { let mut errs : Vec < String > = Vec :: new ( ) ; self . properties . iter_mut ( ) . for_each ( | prop | { // Note that using iter_mut and wanting to step on the prop.answer value is not // possible, as prop.answer is of type &mut and step would "move out of it". The // solution is to use an auxiliary variable; exachange the value with a // placeholder then go on to step the state machine. let mut old_ans = PartialAnswer :: Success ; std :: mem :: swap ( & mut prop . answer , & mut old_ans ) ; match step ( old_ans , event ) { PartialAnswer :: Failure ( _ ) => errs . push ( prop . label . clone ( ) ) , x => prop . answer = x , } } ) ; if errs . is_empty ( ) { Ok ( ( ) ) } else { Err ( errs ) } }
Feeds one event to every property under observation.
Feeds one event to every property under observation .
&mut self
event
&T
&mut self
event
&T