pub trait Notifications: MaybeSend + 'static {
// Required method
fn watch(&self, events: Events<Notification>);
}Expand description
Events the host tells the user about, such as alert triggers, filled orders or a lost connection, for the notifications panel. The host keeps the log; the panel shows what the service pushes, newest first.
watch is called on the UI thread and must return at once. Push from any
thread, runtime or browser task.
use egui_charts::services::{Events, Notification, Notifications};
/// Tells the user once that the session started.
struct Session;
impl Notifications for Session {
fn watch(&self, events: Events<Notification>) {
events.push(Notification::new(chrono::Utc::now(), "Session started"));
}
}Required Methods§
Sourcefn watch(&self, events: Events<Notification>)
fn watch(&self, events: Events<Notification>)
Pushes the recent notifications, oldest first, then each new one until events is
inactive. Called when the panel starts and again after a lagged stream, each time with a
new stream that starts from none.
The stream takes at most 10,000 pushes between two frames: push at most that many recent notifications at once, or the stream lags on every call and none shows.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".