input_actions/binding/
map.rs1use crate::{action, binding::Binding};
2use std::collections::HashMap;
3
4#[derive(Debug, Clone)]
6pub struct ActionMap(HashMap<action::Id, Vec<Binding>>);
7
8impl Default for ActionMap {
9 fn default() -> Self {
10 Self(HashMap::new())
11 }
12}
13
14impl ActionMap {
15 pub fn bind(mut self, action: action::Id, bindings: Vec<Binding>) -> Self {
17 self.0.insert(action, bindings);
18 self
19 }
20
21 pub(crate) fn iter(&self) -> std::collections::hash_map::Iter<'_, action::Id, Vec<Binding>> {
22 self.0.iter()
23 }
24}