Skip to main content

Backend

Trait Backend 

Source
pub trait Backend:
    Send
    + Sync
    + 'static {
    // Required methods
    fn name(&self) -> String;
    fn probe(&self) -> Result<String, String>;
    fn show(
        &self,
        id: u64,
        n: &Notification,
        respond: Box<dyn FnOnce(String) + Send>,
    ) -> Result<(), String>;

    // Provided method
    fn known(&self) -> Option<Result<String, String>> { ... }
}
Expand description

What shows notifications on the desktop. Desktop is the real one; Simulated records them, for tests and the gallery.

Required Methods§

Source

fn name(&self) -> String

A short name: xdg, windows, macos, simulated.

Source

fn probe(&self) -> Result<String, String>

Whether the desktop can show notifications, and through what (the server’s name), or why not. May block: called from a thread.

Source

fn show( &self, id: u64, n: &Notification, respond: Box<dyn FnOnce(String) + Send>, ) -> Result<(), String>

Shows one. respond gets the action the user picks (an action’s id, or default for its body), at most once. May block: called from a thread.

Provided Methods§

Source

fn known(&self) -> Option<Result<String, String>>

Backend::probe’s answer when it is known without asking (taken at connect, and the thread asks nothing).

Implementors§