pub fn poll(&mut self) -> Vec<(ProcessIndex, Fault)> {
        // we'll need to remember which processes are finished
        let mut to_remove = Vec::new();
        let mut faults = Vec::new();

        self.inputs.update(&mut self.devices);

        for (pid, process) in &mut self.processes {
            // set up the device context
            let mut ctx = Context {
                devices: &self.devices,
                inputs: &mut self.inputs,
                outputs: &mut self.outputs,
                current_process: pid,
                variables: RefCell::new(&mut self.variables),
                logger: &mut self.logger,
            };

            match process.poll(&mut ctx) {
                Transition::Completed => to_remove.push(pid),
                Transition::StillRunning => {},
                Transition::Fault(fault) => {
                    faults.push((pid, fault));
                },
            }
        }

        self.outputs.update(&mut self.devices);

        // remove all finished processes
        self.processes.retain(|pid, _| !to_remove.contains(&pid));

        faults
    }
/// Poll all known [`Process`]es, removing any that have run to completion
/// or faulted.
Poll all known [`Process`]es, removing any that have run to completion
or faulted.
Poll all known [ ` Process ` ] es removing any that have run to completion or faulted .
pub fn poll(&mut self) -> Vec<(ProcessIndex, Fault)> {
        // we'll need to remember which processes are finished
        let mut to_remove = Vec::new();
        let mut faults = Vec::new();
        self.inputs.update(&mut self.devices);
        for (pid, process) in &mut self.processes {
            // set up the device context
            let mut ctx = Context {
                devices: &self.devices,
                inputs: &mut self.inputs,
                outputs: &mut self.outputs,
                current_process: pid,
                variables: RefCell::new(&mut self.variables),
                logger: &mut self.logger,
            };
            match process.poll(&mut ctx) {
                Transition::Completed => to_remove.push(pid),
                Transition::StillRunning => {},
                Transition::Fault(fault) => {
                    faults.push((pid, fault));
                },
            }
        }
        self.outputs.update(&mut self.devices);
        // remove all finished processes
        self.processes.retain(|pid, _| !to_remove.contains(&pid));
        faults
    }
pub fn poll ( & mut self ) -> Vec < ( ProcessIndex , Fault ) > { // we'll need to remember which processes are finished let mut to_remove = Vec :: new ( ) ; let mut faults = Vec :: new ( ) ; self . inputs . update ( & mut self . devices ) ; for ( pid , process ) in & mut self . processes { // set up the device context let mut ctx = Context { devices : & self . devices , inputs : & mut self . inputs , outputs : & mut self . outputs , current_process : pid , variables : RefCell :: new ( & mut self . variables ) , logger : & mut self . logger , } ; match process . poll ( & mut ctx ) { Transition :: Completed => to_remove . push ( pid ) , Transition :: StillRunning => { } , Transition :: Fault ( fault ) => { faults . push ( ( pid , fault ) ) ; } , } } self . outputs . update ( & mut self . devices ) ; // remove all finished processes self . processes . retain ( | pid , _ | ! to_remove . contains ( & pid ) ) ; faults }
Poll all known [`Process`]es, removing any that have run to completion
or faulted.
Poll all known [ ` Process ` ] es removing any that have run to completion or faulted .
&mut self
&mut self