Trait Handle

Source
pub trait Handle {
    type Request: for<'de> Deserialize<'de> + Send + Sync + Clone + 'static;
    type Response: Serialize + Send;

    // Required method
    fn handle<'life0, 'life1, 'async_trait>(
        &'life0 self,
        method: &'life1 str,
        req: Option<Self::Request>,
    ) -> Pin<Box<dyn Future<Output = Result<Option<Self::Response>, RPCError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;

    // Provided method
    fn batch_handle<'life0, 'async_trait>(
        &'life0 self,
        reqests: Vec<RPCRequest<Option<Self::Request>>>,
    ) -> Pin<Box<dyn Future<Output = Vec<RPCResponse<Self::Response>>> + Send + 'async_trait>>
       where Self: Sync + 'async_trait,
             'life0: 'async_trait { ... }
}

Required Associated Types§

Source

type Request: for<'de> Deserialize<'de> + Send + Sync + Clone + 'static

Source

type Response: Serialize + Send

Required Methods§

Source

fn handle<'life0, 'life1, 'async_trait>( &'life0 self, method: &'life1 str, req: Option<Self::Request>, ) -> Pin<Box<dyn Future<Output = Result<Option<Self::Response>, RPCError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Provided Methods§

Source

fn batch_handle<'life0, 'async_trait>( &'life0 self, reqests: Vec<RPCRequest<Option<Self::Request>>>, ) -> Pin<Box<dyn Future<Output = Vec<RPCResponse<Self::Response>>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait,

Implementors§