[][src]Trait nvim_rs::rpc::handler::Handler

pub trait Handler: Send + Sync {
    type Writer: AsyncWrite + Send + Sync + Unpin + 'static;
    fn handle_request<'life0, 'async_trait>(
        &'life0 self,
        _name: String,
        _args: Vec<Value>,
        _neovim: Neovim<Self::Writer>
    ) -> Pin<Box<dyn Future<Output = Result<Value, Value>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
, { ... }
fn handle_notify<'life0, 'async_trait>(
        &'life0 self,
        _name: String,
        _args: Vec<Value>,
        _neovim: Neovim<Self::Writer>
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
, { ... } }

The central functionality of a plugin. The trait bounds asure that each asynchronous task can receive a copy of the handler, so some state can be shared.

Associated Types

type Writer: AsyncWrite + Send + Sync + Unpin + 'static

The type where we write our responses to requests. Handling of incoming requests/notifications is done on the io loop, which passes the parsed messages to the handler.

Loading content...

Provided methods

fn handle_request<'life0, 'async_trait>(
    &'life0 self,
    _name: String,
    _args: Vec<Value>,
    _neovim: Neovim<Self::Writer>
) -> Pin<Box<dyn Future<Output = Result<Value, Value>> + Send + 'async_trait>> where
    'life0: 'async_trait,
    Self: 'async_trait, 

Handling an rpc request. The ID's of requests are handled by the neovim instance.

fn handle_notify<'life0, 'async_trait>(
    &'life0 self,
    _name: String,
    _args: Vec<Value>,
    _neovim: Neovim<Self::Writer>
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>> where
    'life0: 'async_trait,
    Self: 'async_trait, 

Handling an rpc notification.

Loading content...

Implementors

impl<Q> Handler for DefaultHandler<Q> where
    Q: AsyncWrite + Send + Sync + Unpin + 'static, 
[src]

type Writer = Q

Loading content...