Support triggering multiple actions
This commit is contained in:
parent
d4a0a1e992
commit
14e9860697
|
@ -27,6 +27,13 @@ impl fmt::Display for Action {
|
||||||
#[derive(Deserialize, StaticType, Debug)]
|
#[derive(Deserialize, StaticType, Debug)]
|
||||||
pub struct Actions(Vec<Action>);
|
pub struct Actions(Vec<Action>);
|
||||||
|
|
||||||
|
impl Actions {
|
||||||
|
// Return the iterator over the inner Vec of Actions
|
||||||
|
pub fn iter(&self) -> std::slice::Iter<Action> {
|
||||||
|
self.0.iter()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl fmt::Display for Actions {
|
impl fmt::Display for Actions {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
write!(f, "Actions(count={})", self.0.len())
|
write!(f, "Actions(count={})", self.0.len())
|
||||||
|
|
|
@ -90,7 +90,8 @@ impl<'a> State<'a> {
|
||||||
|
|
||||||
fn execute_mapping(&mut self, mapping: &Mapping) {
|
fn execute_mapping(&mut self, mapping: &Mapping) {
|
||||||
match mapping {
|
match mapping {
|
||||||
Mapping::Trigger(t) => self.execute_action(t),
|
Mapping::Trigger(act) => self.execute_action(act),
|
||||||
|
Mapping::TriggerMulti(acts) => acts.iter().map(|a| self.execute_action(a)).collect(),
|
||||||
_ => event!(Level::WARN, %mapping, "Ignoring unimplemented mapping"),
|
_ => event!(Level::WARN, %mapping, "Ignoring unimplemented mapping"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue