Skip to main content

NotificationSink

Trait NotificationSink 

Source
pub trait NotificationSink:
    Send
    + Sync
    + 'static {
    // Required method
    fn show<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        summary: &'life1 str,
        body: &'life2 str,
    ) -> Pin<Box<dyn Future<Output = Result<(), NotificationError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
}
Expand description

The dispatcher → OS bridge. Production wires this through LibNotifySink; tests inject InMemorySink.

Why a trait at all: the F14 alternative (a #[cfg(test)] environment-variable hack) couples the prod code path to test configuration AND links notify-rust into the test binary. A trait keeps the boundary explicit and decouples test runtime from D-Bus.

Required Methods§

Source

fn show<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, summary: &'life1 str, body: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<(), NotificationError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Emit a single notification. summary is the title; body is already-sanitized HTML-escaped text suitable for daemons that interpret a subset of HTML markup (KDE, GNOME).

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§