// Map boolean control inputs to simple keypresses when they flip from 0 to 1.
Map boolean control inputs to simple keypresses when they flip from 0 to 1.
Map boolean control inputs to simple keypresses when they flip from 0 to 1 .
fn run_key_mappings(&mut self, ports: &Ports) {
        for key_mapping in &mut self.key_mappings {
            if **((key_mapping.input_port)(ports)) > 0.5 {
                if !key_mapping.last_state {
                    key_mapping.last_state = true;
                    self.work_transmitter.send(Action::Simple(key_mapping.action)).ok();
                }
            } else {
                if key_mapping.last_state {
                    key_mapping.last_state = false;
                }
            }
        }
    }
fn run_key_mappings ( & mut self , ports : & Ports ) { for key_mapping in & mut self . key_mappings { if * * ( ( key_mapping . input_port ) ( ports ) ) > 0.5 { if ! key_mapping . last_state { key_mapping . last_state = true ; self . work_transmitter . send ( Action :: Simple ( key_mapping . action ) ) . ok ( ) ; } } else { if key_mapping . last_state { key_mapping . last_state = false ; } } } }
Map boolean control inputs to simple keypresses when they flip from 0 to 1.
Map boolean control inputs to simple keypresses when they flip from 0 to 1 .
&mut self
ports
&Ports