Trait yew_notifications::Notifiable
source · pub trait Notifiable: Any {
// Required methods
fn id(&self) -> Uuid;
fn apply_tick(&mut self, time: Duration);
fn is_alive(&self) -> bool;
fn is_paused(&self) -> bool;
fn mouse_in(&mut self);
fn mouse_out(&mut self);
}
Expand description
This trait provides an interface for the notification. Everything,
that implements this trait, can be used in the NotificationsProvider
.
Lifetime
Every notification has such thing as lifetime.
This is simply the amount of time that this notification is still “alive” (which means is present on the screen or is visible).
Methods like Notifiable::apply_tick
, Notifiable::is_alive
, etc, are used by library internal to control life of the notification.
Required Methods§
sourcefn id(&self) -> Uuid
fn id(&self) -> Uuid
Returns the id of the notification. Every notification has the id of the Uuid type and it should be unique.
sourcefn apply_tick(&mut self, time: Duration)
fn apply_tick(&mut self, time: Duration)
Applies some amount of time to this notification.
Arguments
time
- An amount of time that has been spent.
sourcefn is_alive(&self) -> bool
fn is_alive(&self) -> bool
Check if the notification is still “alive”. If it returns false, then this notification will be deleted (disappeared) on the next time tick.