Skip to main content

TrayService

Trait TrayService 

Source
pub trait TrayService:
    Debug
    + Send
    + Sync
    + 'static {
    // Required methods
    fn set_title<'life0, 'life1, 'async_trait>(
        &'life0 self,
        title: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn set_badge<'life0, 'async_trait>(
        &'life0 self,
        badge: TrayBadge,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn set_menu<'life0, 'async_trait>(
        &'life0 self,
        items: Vec<TrayMenuItem>,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

A product-facing handle to the system tray.

Present only when the product declared tray = true; absent otherwise. A headless or CLI build gets a no-op, so calling set_title never panics.

Required Methods§

Source

fn set_title<'life0, 'life1, 'async_trait>( &'life0 self, title: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Change the tray tooltip — the text shown on hover.

Source

fn set_badge<'life0, 'async_trait>( &'life0 self, badge: TrayBadge, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Replace the badge on the tray icon.

Source

fn set_menu<'life0, 'async_trait>( &'life0 self, items: Vec<TrayMenuItem>, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Replace the menu. Items are shown in the order given.

The host rebuilds the native menu from these items and maps selection to a host-specific handler — the product never sees a pointer or a platform menu object.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§