pub trait Handler: Send + Sync + Clone + 'static {
type Writer: AsyncWrite + Send + Unpin + 'static;
// 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 Self: 'async_trait,
'life0: 'async_trait { ... }
fn handle_notify<'life0, 'async_trait>(
&'life0 self,
_name: String,
_args: Vec<Value>,
_neovim: Neovim<<Self as Handler>::Writer>
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
}
Expand description
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.
Required Associated Types§
Provided Methods§
sourcefn 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
Self: 'async_trait,
'life0: 'async_trait,
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
Self: 'async_trait,
'life0: 'async_trait,
Handling an rpc request. The ID’s of requests are handled by the
neovim
instance.
sourcefn handle_notify<'life0, 'async_trait>(
&'life0 self,
_name: String,
_args: Vec<Value>,
_neovim: Neovim<<Self as Handler>::Writer>
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn handle_notify<'life0, 'async_trait>(
&'life0 self,
_name: String,
_args: Vec<Value>,
_neovim: Neovim<<Self as Handler>::Writer>
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Handling an rpc notification. Notifications are handled one at a time in the order in which they were received, and will block new requests from being received until handle_notify returns.
Object Safety§
This trait is not object safe.