Trait event_listener::Notification
source · pub trait Notification: NotificationPrivate { }
Expand description
A notification that can be used to notify an Event
.
This type is used by the [Event::notify()
] function to determine how many listeners to wake up, whether
or not to subtract additional listeners, and other properties. The actual internal data is hidden in a
private trait and is intentionally not exposed. This means that users cannot manually implement the
Notification
trait. However, it also means that changing the underlying trait is not a semver breaking
change.
Users can create types that implement notifications using the combinators on the IntoNotification
type.
Typical construction of a Notification
starts with a numeric literal (like 3usize
) and then optionally
adding combinators.
Example
use event_listener::{Event, IntoNotification, Notification};
fn notify(ev: &Event, notify: impl Notification<Tag = ()>) {
ev.notify(notify);
}
notify(&Event::new(), 1.additional());