Struct win7_notifications::Notification

source ·
#[non_exhaustive]
pub struct Notification { pub icon: Option<Vec<u8>>, pub icon_width: u32, pub icon_height: u32, pub appname: String, pub summary: String, pub body: String, pub timeout: Timeout, pub silent: bool, }
Expand description

Describes The notification

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§icon: Option<Vec<u8>>§icon_width: u32§icon_height: u32§appname: String§summary: String§body: String§timeout: Timeout§silent: bool

Implementations§

source§

impl Notification

source

pub fn new() -> Notification

Constructs a new Notification.

Most fields are empty by default, only appname is initialized with the name of the current executable.

source

pub fn appname(&mut self, appname: &str) -> &mut Notification

Overwrite the appname field used for Notification.

source

pub fn summary(&mut self, summary: &str) -> &mut Notification

Set the summary.

Often acts as title of the notification. For more elaborate content use the body field.

source

pub fn body(&mut self, body: &str) -> &mut Notification

Set the content of the body field.

Multiline textual content of the notification. Each line should be treated as a paragraph. html markup is not supported.

source

pub fn icon( &mut self, rgba: Vec<u8>, width: u32, height: u32, ) -> &mut Notification

Set the icon field from 32bpp RGBA data.

The length of rgba must be divisible by 4, and width * height must equal rgba.len() / 4. Otherwise, this will panic.

source

pub fn timeout(&mut self, timeout: Timeout) -> &mut Notification

Set the timeout field.

source

pub fn silent(&mut self, silent: bool) -> &mut Notification

Set the silent field.

source

pub fn show(&self) -> Result<(), u32>

Shows the Notification.

Requires a win32 event_loop to be running on the thread, otherwise the notification will close immediately.

Trait Implementations§

source§

impl Clone for Notification

source§

fn clone(&self) -> Notification

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Notification

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for Notification

source§

fn default() -> Notification

Returns the “default value” for a type. 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> 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> CloneToUninit for T
where T: Clone,

source§

default unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

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

§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

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

§

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.