pub trait DaemonService: Send + Sync {
// Required methods
fn name(&self) -> &'static str;
fn handle<'life0, 'life1, 'async_trait>(
&'life0 self,
op: &'life1 str,
payload: Value,
) -> Pin<Box<dyn Future<Output = Result<Value>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn menu(&self) -> MenuSnapshot;
fn menu_action<'life0, 'life1, 'async_trait>(
&'life0 self,
action_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn status<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = ServiceStatus> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn shutdown<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}Expand description
A long-lived unit of work supervised by the daemon.
Implementations are registered in a ServiceRegistry
and are assumed live from registration until shutdown.
Required Methods§
Sourcefn name(&self) -> &'static str
fn name(&self) -> &'static str
Stable identifier used to route control-socket envelopes to this service
(the envelope’s service field) and to label its status/menu.
Sourcefn handle<'life0, 'life1, 'async_trait>(
&'life0 self,
op: &'life1 str,
payload: Value,
) -> Pin<Box<dyn Future<Output = Result<Value>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn handle<'life0, 'life1, 'async_trait>(
&'life0 self,
op: &'life1 str,
payload: Value,
) -> Pin<Box<dyn Future<Output = Result<Value>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Handles an operation routed to this service, returning a JSON payload.
Cheap snapshot of the service’s tray submenu, polled by the menu-bar shell. Must not block.
Performs a tray menu action previously surfaced by menu,
identified by its MenuAction::id.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".