pub fn clear_action(
        &mut self,
        action: &A,
        input_mode: Option<InputMode>,
    ) -> Option<PetitSet<UserInput, 16>> {
        // FIXME: does not appear to be working correctly
        if let Some(input_mode) = input_mode {
            // Pull out all the matching inputs
            if let Some(bindings) = self.map.remove(action) {
                let mut retained_set: PetitSet<UserInput, 16> = PetitSet::default();
                let mut removed_set: PetitSet<UserInput, 16> = PetitSet::default();

                for input in bindings {
                    if input.matches_input_mode(input_mode) {
                        removed_set.insert(input);
                    } else {
                        retained_set.insert(input);
                    }
                }

                // Put back the ones that didn't match
                for input in retained_set.iter() {
                    self.insert(action.clone(), input.clone());
                }

                // Cache clashes now, to ensure a clean state
                self.cache_possible_clashes();

                // Return the items that matched
                if removed_set.is_empty() {
                    None
                } else {
                    Some(removed_set)
                }
            } else {
                None
            }
        } else {
            let removed = self.map.remove(action);
            // Cache clashes now, to ensure a clean state
            self.cache_possible_clashes();
            removed
        }
    }
/// Clears all inputs registered for the `action` that use the supplied `input_mode`
///
/// If `input_mode` is `None`, all inputs will be cleared regardless of input mode.
///
/// For chords, an input will be removed if any of the contained buttons use that input mode.
///
/// Returns all previously registered inputs, if any


For chords, an input will be removed if any of the contained buttons use that input mode.

Returns all previously registered inputs, if any
For chords an input will be removed if any of the contained buttons use that input mode . Returns all previously registered inputs if any
pub fn clear_action(
        &mut self,
        action: &A,
        input_mode: Option<InputMode>,
    ) -> Option<PetitSet<UserInput, 16>> {
        // FIXME: does not appear to be working correctly
        if let Some(input_mode) = input_mode {
            // Pull out all the matching inputs
            if let Some(bindings) = self.map.remove(action) {
                let mut retained_set: PetitSet<UserInput, 16> = PetitSet::default();
                let mut removed_set: PetitSet<UserInput, 16> = PetitSet::default();
                for input in bindings {
                    if input.matches_input_mode(input_mode) {
                        removed_set.insert(input);
                    } else {
                        retained_set.insert(input);
                    }
                }
                // Put back the ones that didn't match
                for input in retained_set.iter() {
                    self.insert(action.clone(), input.clone());
                }
                // Cache clashes now, to ensure a clean state
                self.cache_possible_clashes();
                // Return the items that matched
                if removed_set.is_empty() {
                    None
                } else {
                    Some(removed_set)
                }
            } else {
                None
            }
        } else {
            let removed = self.map.remove(action);
            // Cache clashes now, to ensure a clean state
            self.cache_possible_clashes();
            removed
        }
    }
pub fn clear_action ( & mut self , action : & A , input_mode : Option < InputMode > , ) -> Option < PetitSet < UserInput , 16 > > { // FIXME: does not appear to be working correctly if let Some ( input_mode ) = input_mode { // Pull out all the matching inputs if let Some ( bindings ) = self . map . remove ( action ) { let mut retained_set : PetitSet < UserInput , 16 > = PetitSet :: default ( ) ; let mut removed_set : PetitSet < UserInput , 16 > = PetitSet :: default ( ) ; for input in bindings { if input . matches_input_mode ( input_mode ) { removed_set . insert ( input ) ; } else { retained_set . insert ( input ) ; } } // Put back the ones that didn't match for input in retained_set . iter ( ) { self . insert ( action . clone ( ) , input . clone ( ) ) ; } // Cache clashes now, to ensure a clean state self . cache_possible_clashes ( ) ; // Return the items that matched if removed_set . is_empty ( ) { None } else { Some ( removed_set ) } } else { None } } else { let removed = self . map . remove ( action ) ; // Cache clashes now, to ensure a clean state self . cache_possible_clashes ( ) ; removed } }
Clears all inputs registered for the `action` that use the supplied `input_mode`
If `input_mode` is `None`, all inputs will be cleared regardless of input mode.
Clears all inputs registered for the ` action ` that use the supplied ` input_mode ` If ` input_mode ` is ` None ` all inputs will be cleared regardless of input mode .
&mut self
action
&A
input_mode
Option<InputMode>
&mut self
action
&A
input_mode
Option<InputMode>