🎨 Passes action keys by reference in dispatch
This commit is contained in:
parent
b481d84cba
commit
5f9c1e4b15
9 changed files with 41 additions and 31 deletions
|
|
@ -19,12 +19,12 @@ pub fn add_action(action: ActionBox) {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn dispatch_actions<A, B, F>(key: ActionKey, f: F)
|
||||
pub fn dispatch_actions<A, B, F>(key: &ActionKey, f: F)
|
||||
where
|
||||
A: ActionTrait,
|
||||
F: FnMut(&A) -> B,
|
||||
{
|
||||
if let Some(list) = ACTIONS.read().unwrap().get(&key) {
|
||||
list.iter_map(f)
|
||||
if let Some(list) = ACTIONS.read().unwrap().get(key) {
|
||||
list.iter_map(f);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue