Skip to main content

Notification

Struct Notification 

Source
pub struct Notification { /* private fields */ }
Expand description

A notification that can be shown in a window or by the host operating system.

This class represents a notification that can be displayed either in a window using a WindowNotificationManager or by the host operating system (to be implemented).

Implementations§

Source§

impl Notification

Source

pub fn new( title: Option<String>, message: Option<String>, type_: NotificationType, expiration: Option<Duration>, on_click: Option<Rc<dyn Fn()>>, on_close: Option<Rc<dyn Fn()>>, ) -> Rc<Self>

Creates a notification.

  • title: the title of the notification.
  • message: the message to be displayed in the notification.
  • type_: the NotificationType of the notification.
  • expiration: the expiry time at which the notification will close (five seconds when None). Use Duration::ZERO for notifications that will remain open.
  • on_click: an action to call when the notification is clicked.
  • on_close: an action to call when the notification is closed.
Source

pub fn empty() -> Rc<Self>

Creates a notification without title and message, of the information type, that expires after five seconds.

Source

pub fn with_overrides( title: Option<String>, message: Option<String>, type_: NotificationType, expiration: Option<Duration>, on_click: Option<Rc<dyn Fn()>>, on_close: Option<Rc<dyn Fn()>>, overrides: Rc<dyn NotificationOverrides>, ) -> Rc<Self>

Creates a notification whose overridable members are replaced by overrides: the form a class deriving from the notification takes.

Source

pub fn title(&self) -> Option<String>

The title of the notification.

Source

pub fn set_title(&self, value: Option<String>)

Source

pub fn with_title(self: Rc<Self>, value: Option<String>) -> Rc<Self>

Sets the title; returns the notification for chaining.

Source

pub fn message(&self) -> Option<String>

The notification message.

Source

pub fn set_message(&self, value: Option<String>)

Source

pub fn with_message(self: Rc<Self>, value: Option<String>) -> Rc<Self>

Sets the message; returns the notification for chaining.

Source

pub fn type_(&self) -> NotificationType

The NotificationType of the notification.

Source

pub fn set_type(&self, value: NotificationType)

Source

pub fn with_type(self: Rc<Self>, value: NotificationType) -> Rc<Self>

Sets the type; returns the notification for chaining.

Source

pub fn expiration(&self) -> Duration

The expiration time of the notification after which it will automatically close. If the value is Duration::ZERO then the notification will remain open until the user closes it.

Source

pub fn set_expiration(&self, value: Duration)

Source

pub fn with_expiration(self: Rc<Self>, value: Duration) -> Rc<Self>

Sets the expiration; returns the notification for chaining.

Source

pub fn on_click(&self) -> Option<Rc<dyn Fn()>>

An action to be run when the notification is clicked.

Source

pub fn set_on_click(&self, value: Option<Rc<dyn Fn()>>)

Source

pub fn with_on_click(self: Rc<Self>, value: Option<Rc<dyn Fn()>>) -> Rc<Self>

Sets the click action; returns the notification for chaining.

Source

pub fn on_close(&self) -> Option<Rc<dyn Fn()>>

An action to be run when the notification is closed.

Source

pub fn set_on_close(&self, value: Option<Rc<dyn Fn()>>)

Source

pub fn with_on_close(self: Rc<Self>, value: Option<Rc<dyn Fn()>>) -> Rc<Self>

Sets the close action; returns the notification for chaining.

Source

pub fn on_property_changed(&self, property_name: Option<&str>)

Raises the property changed event. Overridable: see NotificationOverrides::on_property_changed.

Source

pub fn base_on_property_changed(&self, property_name: Option<&str>)

The implementation of on_property_changed of this class, for overrides.

Trait Implementations§

Source§

impl INotification for Notification

Source§

fn title(&self) -> Option<String>

Gets the title of the notification.
Source§

fn message(&self) -> Option<String>

Gets the notification message.
Source§

fn type_(&self) -> NotificationType

Gets the NotificationType of the notification.
Source§

fn expiration(&self) -> Duration

Gets the expiration time of the notification after which it will automatically close. If the value is Duration::ZERO then the notification will remain open until the user closes it.
Source§

fn on_click(&self) -> Option<Rc<dyn Fn()>>

Gets an action to be run when the notification is clicked.
Source§

fn on_close(&self) -> Option<Rc<dyn Fn()>>

Gets an action to be run when the notification is closed.
Source§

fn to_boxed(self: Rc<Self>) -> BoxedValue

The notification as an untyped value: the object itself, as content controls display it and bindings read it.
Source§

impl INotifyPropertyChanged for Notification

Source§

fn property_changed(&self) -> &Event<str>

The event raised when a property value changes.
Source§

fn as_notify_property_changing(&self) -> Option<&dyn INotifyPropertyChanging>

The object as INotifyPropertyChanging, when it also raises the event of a property that is about to change; None by default. Read more
Source§

impl Model for Notification

Source§

fn describe(builder: ModelTypeBuilder<Self>) -> ModelTypeBuilder<Self>

Describes the type’s properties, methods and notification interfaces.
Source§

fn register()

Registers the metadata on the current thread, once.
Source§

fn new_model(value: Self) -> Rc<Self>

Wraps an instance into its shared, bindable form.
Source§

impl PartialEq for Notification

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> AnyValue for T
where T: PartialEq + 'static,

Source§

fn any_value_as_any(&self) -> &(dyn Any + 'static)

Source§

fn any_value_eq(&self, other: &(dyn AnyValue + 'static)) -> bool

Source§

fn any_value_type_name(&self) -> &'static str

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> ClassDefaults for T
where T: ?Sized,

Source§

fn static_constructor()

The static constructor of a type: work done once per thread, after the properties of the type are registered and before its first instance exists (class handlers, affects_render, metadata overrides). Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.