# Notification

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-controls/notifications/struct-notification/

**struct** · [`ferroui-controls`](/docs/0.5.0/api/ferroui-controls/) · v0.5.0

```rust
struct Notification
```

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

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/notifications/notification.rs#L29)

## Members

- [`new`](#function-new)
- [`empty`](#function-empty)
- [`with_overrides`](#function-with_overrides)
- [`title`](#function-title)
- [`set_title`](#function-set_title)
- [`with_title`](#function-with_title)
- [`message`](#function-message)
- [`set_message`](#function-set_message)
- [`with_message`](#function-with_message)
- [`type_`](#function-type_)
- [`set_type`](#function-set_type)
- [`with_type`](#function-with_type)
- [`expiration`](#function-expiration)
- [`set_expiration`](#function-set_expiration)
- [`with_expiration`](#function-with_expiration)
- [`on_click`](#function-on_click)
- [`set_on_click`](#function-set_on_click)
- [`with_on_click`](#function-with_on_click)
- [`on_close`](#function-on_close)
- [`set_on_close`](#function-set_on_close)
- [`with_on_close`](#function-with_on_close)
- [`on_property_changed`](#function-on_property_changed)
- [`base_on_property_changed`](#function-base_on_property_changed)

<a id="function-new"></a>

### new

```rust
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](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/notifications/notification.rs#L54)

<a id="function-empty"></a>

### empty

```rust
fn empty() -> Rc<Self>
```

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

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/notifications/notification.rs#L67)

<a id="function-with_overrides"></a>

### with_overrides

```rust
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](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/notifications/notification.rs#L73)

<a id="function-title"></a>

### title

```rust
fn title(self: &Self) -> Option<String>
```

The title of the notification.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/notifications/notification.rs#L137)

<a id="function-set_title"></a>

### set_title

```rust
fn set_title(self: &Self, value: Option<String>)
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/notifications/notification.rs#L141)

<a id="function-with_title"></a>

### with_title

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

Sets the title; returns the notification for chaining.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/notifications/notification.rs#L149)

<a id="function-message"></a>

### message

```rust
fn message(self: &Self) -> Option<String>
```

The notification message.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/notifications/notification.rs#L155)

<a id="function-set_message"></a>

### set_message

```rust
fn set_message(self: &Self, value: Option<String>)
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/notifications/notification.rs#L159)

<a id="function-with_message"></a>

### with_message

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

Sets the message; returns the notification for chaining.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/notifications/notification.rs#L167)

<a id="function-type_"></a>

### type_

```rust
fn type_(self: &Self) -> NotificationType
```

The `NotificationType` of the notification.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/notifications/notification.rs#L173)

<a id="function-set_type"></a>

### set_type

```rust
fn set_type(self: &Self, value: NotificationType)
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/notifications/notification.rs#L177)

<a id="function-with_type"></a>

### with_type

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

Sets the type; returns the notification for chaining.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/notifications/notification.rs#L182)

<a id="function-expiration"></a>

### expiration

```rust
fn expiration(self: &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](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/notifications/notification.rs#L190)

<a id="function-set_expiration"></a>

### set_expiration

```rust
fn set_expiration(self: &Self, value: Duration)
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/notifications/notification.rs#L194)

<a id="function-with_expiration"></a>

### with_expiration

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

Sets the expiration; returns the notification for chaining.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/notifications/notification.rs#L199)

<a id="function-on_click"></a>

### on_click

```rust
fn on_click(self: &Self) -> Option<Rc<dyn Fn() -> ()>>
```

An action to be run when the notification is clicked.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/notifications/notification.rs#L205)

<a id="function-set_on_click"></a>

### set_on_click

```rust
fn set_on_click(self: &Self, value: Option<Rc<dyn Fn() -> ()>>)
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/notifications/notification.rs#L209)

<a id="function-with_on_click"></a>

### with_on_click

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

Sets the click action; returns the notification for chaining.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/notifications/notification.rs#L214)

<a id="function-on_close"></a>

### on_close

```rust
fn on_close(self: &Self) -> Option<Rc<dyn Fn() -> ()>>
```

An action to be run when the notification is closed.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/notifications/notification.rs#L220)

<a id="function-set_on_close"></a>

### set_on_close

```rust
fn set_on_close(self: &Self, value: Option<Rc<dyn Fn() -> ()>>)
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/notifications/notification.rs#L224)

<a id="function-with_on_close"></a>

### with_on_close

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

Sets the close action; returns the notification for chaining.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/notifications/notification.rs#L229)

<a id="function-on_property_changed"></a>

### on_property_changed

```rust
fn on_property_changed(self: &Self, property_name: Option<&str>)
```

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

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/notifications/notification.rs#L236)

<a id="function-base_on_property_changed"></a>

### base_on_property_changed

```rust
fn base_on_property_changed(self: &Self, property_name: Option<&str>)
```

The implementation of
`on_property_changed` of this class, for
overrides.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/notifications/notification.rs#L246)

## Trait implementations

- `Send`
- `Sync`
- `Freeze`
- `UnsafeUnpin`
- `Unpin`
- `UnwindSafe`
- `RefUnwindSafe`
- `Borrow<T>`
- `BorrowMut<T>`
- `Into<U>`
- `From<T>`
- `TryInto<U>`
- `TryFrom<U>`
- `Any`
- [`AnyValue`](/docs/0.5.0/api/ferroui-base/trait-anyvalue/)
- [`ClassDefaults`](/docs/0.5.0/api/ferroui-base/trait-classdefaults/)
- `ErasedDestructor`
- `IntoEither`
- [`INotification`](/docs/0.5.0/api/ferroui-controls/notifications/trait-inotification/)
- [`INotifyPropertyChanged`](/docs/0.5.0/api/ferroui-base/data/model/use-inotifypropertychanged/)
- `PartialEq`
- [`Model`](/docs/0.5.0/api/ferroui-base/data/model/trait-model/)
- [`MarkupTyped`](/docs/0.5.0/api/ferroui-base/metadata/trait-markuptyped/)

## Availability

Extracted for `aarch64-apple-darwin`. Cargo features are listed in the [crate index](/docs/0.5.0/api/).
