pub trait PluginExt{
// Required methods
fn name(&self) -> &str;
fn search<'life0, 'life1, 'async_trait>(
&'life0 mut self,
query: &'life1 str,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn activate<'life0, 'async_trait>(
&'life0 mut self,
id: Indice,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
// Provided methods
fn activate_context<'life0, 'async_trait>(
&'life0 mut self,
_id: Indice,
_context: Indice,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: Send + 'async_trait,
'life0: 'async_trait { ... }
fn complete<'life0, 'async_trait>(
&'life0 mut self,
_id: Indice,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: Send + 'async_trait,
'life0: 'async_trait { ... }
fn context<'life0, 'async_trait>(
&'life0 mut self,
_id: Indice,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: Send + 'async_trait,
'life0: 'async_trait { ... }
fn exit(&mut self) { ... }
fn interrupt<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: Send + 'async_trait,
'life0: 'async_trait { ... }
fn quit<'life0, 'async_trait>(
&'life0 mut self,
_id: Indice,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: Send + 'async_trait,
'life0: 'async_trait { ... }
fn respond_with<'life0, 'async_trait>(
&'life0 self,
response: PluginResponse,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: Sync + 'async_trait,
'life0: 'async_trait { ... }
fn run<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: Send + 'async_trait,
'life0: 'async_trait { ... }
fn init_logging(&self) { ... }
}Expand description
A helper trait to create pop-launcher plugins.
Required Methods§
Sourcefn name(&self) -> &str
fn name(&self) -> &str
The name of our plugin, currently this is used internally to create the plugin log file at
$XDG_STATE_HOME/pop-launcher/{name}.log
Sourcefn search<'life0, 'life1, 'async_trait>(
&'life0 mut self,
query: &'life1 str,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn search<'life0, 'life1, 'async_trait>(
&'life0 mut self,
query: &'life1 str,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Handle a Request::Search issued by pop-launcher.
To send search result back use PluginResponse::Append.
Once finished PluginResponse::Finished is expected to notify the search result are ready to be displayed.
Sourcefn activate<'life0, 'async_trait>(
&'life0 mut self,
id: Indice,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn activate<'life0, 'async_trait>(
&'life0 mut self,
id: Indice,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Define how the plugin should handle Request::Activate request.
Typically run the requested entry (for instance using super::plugins::xdg_open)
and close the client with a PluginResponse::Close
Provided Methods§
Sourcefn activate_context<'life0, 'async_trait>(
&'life0 mut self,
_id: Indice,
_context: Indice,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: Send + 'async_trait,
'life0: 'async_trait,
fn activate_context<'life0, 'async_trait>(
&'life0 mut self,
_id: Indice,
_context: Indice,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: Send + 'async_trait,
'life0: 'async_trait,
Define how the plugin should handle Request::ActivateContext request.
Typically run the requested entry with the provided context (for instance using super::plugins::xdg_open)
and close the client with a PluginResponse::Close
Sourcefn complete<'life0, 'async_trait>(
&'life0 mut self,
_id: Indice,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: Send + 'async_trait,
'life0: 'async_trait,
fn complete<'life0, 'async_trait>(
&'life0 mut self,
_id: Indice,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: Send + 'async_trait,
'life0: 'async_trait,
Handle an autocompletion request from the client
Sourcefn context<'life0, 'async_trait>(
&'life0 mut self,
_id: Indice,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: Send + 'async_trait,
'life0: 'async_trait,
fn context<'life0, 'async_trait>(
&'life0 mut self,
_id: Indice,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: Send + 'async_trait,
'life0: 'async_trait,
pop-launcher request the context for the given SearchResult id.
to send the requested context use PluginResponse::Context
Sourcefn exit(&mut self)
fn exit(&mut self)
This is automatically called after pop-launcher requests the plugin to exit.
Use this only if your plugin does not need to perform specific clean ups.
Sourcefn interrupt<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: Send + 'async_trait,
'life0: 'async_trait,
fn interrupt<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: Send + 'async_trait,
'life0: 'async_trait,
Whenever a new search query is issued, pop-launcher will send a Request::Interrupt
so we can stop any ongoing computation before handling the next query.
This is especially useful for plugins that rely on external services
to get their search results (a HTTP endpoint for instance)
Sourcefn quit<'life0, 'async_trait>(
&'life0 mut self,
_id: Indice,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: Send + 'async_trait,
'life0: 'async_trait,
fn quit<'life0, 'async_trait>(
&'life0 mut self,
_id: Indice,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: Send + 'async_trait,
'life0: 'async_trait,
The launcher is asking us to quit a specific item.
Sourcefn respond_with<'life0, 'async_trait>(
&'life0 self,
response: PluginResponse,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
fn respond_with<'life0, 'async_trait>(
&'life0 self,
response: PluginResponse,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
A helper function to send PluginResponse back to pop-launcher
Sourcefn run<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: Send + 'async_trait,
'life0: 'async_trait,
fn run<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: Send + 'async_trait,
'life0: 'async_trait,
Run the plugin
fn init_logging(&self)
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.