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§

source

fn id(&self) -> Uuid

Returns the id of the notification. Every notification has the id of the Uuid type and it should be unique.

source

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.
source

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.

source

fn is_paused(&self) -> bool

Check if the notification is still “paused”. It means, that when notification is paused (this function returns true) then time does not affect the notification lifetime.

source

fn mouse_in(&mut self)

This function calls when the mouse enters this notification.

source

fn mouse_out(&mut self)

This function calls when the mouse leaves this notification.

Implementors§