PluginExt

Trait PluginExt 

Source
pub trait PluginExt
where Self: Sized + Send,
{ // 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§

Source

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

Source

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.

Source

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§

Source

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

Source

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

Source

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

Source

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.

Source

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)

Source

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.

Source

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

Source

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

Source

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.

Implementors§