pub fn insert(&mut self, action: A, input: impl Into<UserInput>) -> &mut Self {
        let input = input.into();

        // Don't insert Null inputs into the map
        if input == UserInput::Null {
            return self;
        }

        // Don't overflow the set!
        if self.n_registered(&action, None) >= 16 {
            return self;
        }

        // Respect any per-input-mode caps that have been set
        if let Some(per_mode_cap) = self.per_mode_cap {
            for input_mode in input.input_modes() {
                if self.n_registered(&action, Some(input_mode)) >= per_mode_cap {
                    return self;
                }
            }
        }

        if let Some(existing_set) = self.map.get_mut(&action) {
            // Add the new input binding to the existing set
            existing_set.insert(input);
        } else {
            // Add the new input binding to a new set
            let mut new_set = PetitSet::default();
            new_set.insert(input);
            self.map.insert(action, new_set);
        }

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

        self
    }
/// Insert a mapping between `action` and `input`
///
/// Existing mappings for that action will not be overwritten.
/// If the set for this action is already full, this insertion will silently fail.
Insert a mapping between `action` and `input`
Existing mappings for that action will not be overwritten.
If the set for this action is already full, this insertion will silently fail.
Insert a mapping between ` action ` and ` input ` Existing mappings for that action will not be overwritten . If the set for this action is already full this insertion will silently fail .
pub fn insert(&mut self, action: A, input: impl Into<UserInput>) -> &mut Self {
        let input = input.into();
        // Don't insert Null inputs into the map
        if input == UserInput::Null {
            return self;
        }
        // Don't overflow the set!
        if self.n_registered(&action, None) >= 16 {
            return self;
        }
        // Respect any per-input-mode caps that have been set
        if let Some(per_mode_cap) = self.per_mode_cap {
            for input_mode in input.input_modes() {
                if self.n_registered(&action, Some(input_mode)) >= per_mode_cap {
                    return self;
                }
            }
        }
        if let Some(existing_set) = self.map.get_mut(&action) {
            // Add the new input binding to the existing set
            existing_set.insert(input);
        } else {
            // Add the new input binding to a new set
            let mut new_set = PetitSet::default();
            new_set.insert(input);
            self.map.insert(action, new_set);
        }
        // Cache clashes now, to ensure a clean state
        self.cache_possible_clashes();
        self
    }
pub fn insert ( & mut self , action : A , input : impl Into < UserInput > ) -> & mut Self { let input = input . into ( ) ; // Don't insert Null inputs into the map if input == UserInput :: Null { return self ; } // Don't overflow the set! if self . n_registered ( & action , None ) >= 16 { return self ; } // Respect any per-input-mode caps that have been set if let Some ( per_mode_cap ) = self . per_mode_cap { for input_mode in input . input_modes ( ) { if self . n_registered ( & action , Some ( input_mode ) ) >= per_mode_cap { return self ; } } } if let Some ( existing_set ) = self . map . get_mut ( & action ) { // Add the new input binding to the existing set existing_set . insert ( input ) ; } else { // Add the new input binding to a new set let mut new_set = PetitSet :: default ( ) ; new_set . insert ( input ) ; self . map . insert ( action , new_set ) ; } // Cache clashes now, to ensure a clean state self . cache_possible_clashes ( ) ; self }
Insert a mapping between `action` and `input`
Existing mappings for that action will not be overwritten.
Insert a mapping between ` action ` and ` input ` Existing mappings for that action will not be overwritten .
&mut self
action
A
input
impl Into<UserInput>
&mut self
action
A
input
impl Into<UserInput>