pub fn remove_action_binding<A>(
        &mut self,
        id: &A,
        binding: &[Button],
    ) -> Result<(), ActionRemovedError>
    where
        T::Action: Borrow<A>,
        A: Hash + Eq + ?Sized,
    {
        for i in 0..binding.len() {
            for j in (i + 1)..binding.len() {
                if binding[i] == binding[j] {
                    return Err(ActionRemovedError::BindingContainsDuplicates);
                }
            }
        }
        let kill_it;
        if let Some(action_bindings) = self.actions.get_mut(id) {
            let index = action_bindings.iter().position(|b| {
                b.len() == binding.len()
                    // The bindings can be provided in any order, but they must all
                    // be the same bindings.
                    && b.iter().all(|b| binding.iter().any(|binding| b == binding))
            });
            if let Some(index) = index {
                action_bindings.swap_remove(index);
            } else {
                return Err(ActionRemovedError::ActionExistsButBindingDoesnt);
            }
            kill_it = action_bindings.is_empty();
        } else {
            return Err(ActionRemovedError::ActionNotFound);
        }
        if kill_it {
            self.actions.remove(id);
        }
        Ok(())
    }
/// Removes an action binding that was assigned previously.
Removes an action binding that was assigned previously.
Removes an action binding that was assigned previously .
pub fn remove_action_binding<A>(
        &mut self,
        id: &A,
        binding: &[Button],
    ) -> Result<(), ActionRemovedError>
    where
        T::Action: Borrow<A>,
        A: Hash + Eq + ?Sized,
    {
        for i in 0..binding.len() {
            for j in (i + 1)..binding.len() {
                if binding[i] == binding[j] {
                    return Err(ActionRemovedError::BindingContainsDuplicates);
                }
            }
        }
        let kill_it;
        if let Some(action_bindings) = self.actions.get_mut(id) {
            let index = action_bindings.iter().position(|b| {
                b.len() == binding.len()
                    // The bindings can be provided in any order, but they must all
                    // be the same bindings.
                    && b.iter().all(|b| binding.iter().any(|binding| b == binding))
            });
            if let Some(index) = index {
                action_bindings.swap_remove(index);
            } else {
                return Err(ActionRemovedError::ActionExistsButBindingDoesnt);
            }
            kill_it = action_bindings.is_empty();
        } else {
            return Err(ActionRemovedError::ActionNotFound);
        }
        if kill_it {
            self.actions.remove(id);
        }
        Ok(())
    }
pub fn remove_action_binding < A > ( & mut self , id : & A , binding : & [ Button ] , ) -> Result < ( ) , ActionRemovedError > where T :: Action : Borrow < A > , A : Hash + Eq + ? Sized , { for i in 0 .. binding . len ( ) { for j in ( i + 1 ) .. binding . len ( ) { if binding [ i ] == binding [ j ] { return Err ( ActionRemovedError :: BindingContainsDuplicates ) ; } } } let kill_it ; if let Some ( action_bindings ) = self . actions . get_mut ( id ) { let index = action_bindings . iter ( ) . position ( | b | { b . len ( ) == binding . len ( ) // The bindings can be provided in any order, but they must all // be the same bindings. && b . iter ( ) . all ( | b | binding . iter ( ) . any ( | binding | b == binding ) ) } ) ; if let Some ( index ) = index { action_bindings . swap_remove ( index ) ; } else { return Err ( ActionRemovedError :: ActionExistsButBindingDoesnt ) ; } kill_it = action_bindings . is_empty ( ) ; } else { return Err ( ActionRemovedError :: ActionNotFound ) ; } if kill_it { self . actions . remove ( id ) ; } Ok ( ( ) ) }
Removes an action binding that was assigned previously.
Removes an action binding that was assigned previously .
&mut self
id
&A
binding
&[Button]