Trait jsonrpsee_http_client::traits::Client[][src]

pub trait Client {
    #[must_use]
    fn notification<'a, 'life0, 'async_trait>(
        &'life0 self,
        method: &'a str,
        params: JsonRpcParams<'a>
    ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + 'async_trait + Send, Global>>
    where
        'a: 'async_trait,
        'life0: 'async_trait,
        Self: 'async_trait
;
#[must_use] fn request<'a, 'life0, 'async_trait, R>(
        &'life0 self,
        method: &'a str,
        params: JsonRpcParams<'a>
    ) -> Pin<Box<dyn Future<Output = Result<R, Error>> + 'async_trait + Send, Global>>
    where
        'a: 'async_trait,
        'life0: 'async_trait,
        Self: 'async_trait,
        R: DeserializeOwned + 'async_trait
;
#[must_use] fn batch_request<'a, 'life0, 'async_trait, R>(
        &'life0 self,
        batch: Vec<(&'a str, JsonRpcParams<'a>), Global>
    ) -> Pin<Box<dyn Future<Output = Result<Vec<R, Global>, Error>> + 'async_trait + Send, Global>>
    where
        'a: 'async_trait,
        'life0: 'async_trait,
        Self: 'async_trait,
        R: DeserializeOwned + Default + Clone + 'async_trait
; }
Expand description

JSON-RPC client interface that can make requests and notifications.

Required methods

#[must_use]
fn notification<'a, 'life0, 'async_trait>(
    &'life0 self,
    method: &'a str,
    params: JsonRpcParams<'a>
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + 'async_trait + Send, Global>> where
    'a: 'async_trait,
    'life0: 'async_trait,
    Self: 'async_trait, 
[src]

#[must_use]
fn request<'a, 'life0, 'async_trait, R>(
    &'life0 self,
    method: &'a str,
    params: JsonRpcParams<'a>
) -> Pin<Box<dyn Future<Output = Result<R, Error>> + 'async_trait + Send, Global>> where
    'a: 'async_trait,
    'life0: 'async_trait,
    Self: 'async_trait,
    R: DeserializeOwned + 'async_trait, 
[src]

#[must_use]
fn batch_request<'a, 'life0, 'async_trait, R>(
    &'life0 self,
    batch: Vec<(&'a str, JsonRpcParams<'a>), Global>
) -> Pin<Box<dyn Future<Output = Result<Vec<R, Global>, Error>> + 'async_trait + Send, Global>> where
    'a: 'async_trait,
    'life0: 'async_trait,
    Self: 'async_trait,
    R: DeserializeOwned + Default + Clone + 'async_trait, 
[src]

Send a batch request.

The response to batch are returned in the same order as it was inserted in the batch.

Returns Ok if all requests in the batch were answered successfully. Returns Error if any of the requests in batch fails.

Implementors

impl Client for HttpClient[src]

fn request<'a, 'life0, 'async_trait, R>(
    &'life0 self,
    method: &'a str,
    params: JsonRpcParams<'a>
) -> Pin<Box<dyn Future<Output = Result<R, Error>> + Send + 'async_trait>> where
    R: DeserializeOwned,
    'a: 'async_trait,
    R: 'async_trait,
    'life0: 'async_trait,
    Self: 'async_trait, 
[src]

Perform a request towards the server.

fn notification<'a, 'life0, 'async_trait>(
    &'life0 self,
    method: &'a str,
    params: JsonRpcParams<'a>
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>> where
    'a: 'async_trait,
    'life0: 'async_trait,
    Self: 'async_trait, 
[src]

fn batch_request<'a, 'life0, 'async_trait, R>(
    &'life0 self,
    batch: Vec<(&'a str, JsonRpcParams<'a>)>
) -> Pin<Box<dyn Future<Output = Result<Vec<R>, Error>> + Send + 'async_trait>> where
    R: DeserializeOwned + Default + Clone,
    'a: 'async_trait,
    R: 'async_trait,
    'life0: 'async_trait,
    Self: 'async_trait, 
[src]