collate cancelled

This commit is contained in:
Daniel Griffen 2018-10-28 19:55:37 -07:00
parent 3c3e8754ad
commit fedb32d242
No known key found for this signature in database
GPG Key ID: 315FB75FAC745B68
1 changed files with 4 additions and 4 deletions

View File

@ -72,7 +72,6 @@ macro_rules! post_event {
fun(event);
}
},)+); // big tuple of (Handlers<type>, Handlers<type>, Handlers<type>, Handlers<type>, ...)
}
}
}
@ -97,7 +96,7 @@ macro_rules! post_event_cancellable {
}
test(event);
let cancelled = ($({
let cancelled = [$({
// event type setup
static EVENT_ID: ::std::sync::atomic::AtomicUsize = ::std::sync::atomic::ATOMIC_USIZE_INIT;
static EVENT_ID_INIT: ::std::sync::Once = ::std::sync::ONCE_INIT;
@ -110,15 +109,16 @@ macro_rules! post_event_cancellable {
let handlers = $crate::get_post_targets::<$t>(bus, event, id);
for (_pri, fun) in handlers.iter() {
fun(event as &mut $t);
if Cancellable::cancelled(event) {
break;
}
fun(event as &mut $t);
}
event.cancelled()
},)+); // big tuple of (Handlers<type>, Handlers<type>, Handlers<type>, Handlers<type>, ...)
},)+]; // big tuple of (Handlers<type>, Handlers<type>, Handlers<type>, Handlers<type>, ...)
cancelled.iter().fold(false, |n, i| n || *i)
}
}
}