Trait JsonRpcProvider

Source
pub trait JsonRpcProvider:
    Debug
    + Send
    + Sync {
    type Error: Into<ProviderError>;

    // Required method
    fn fetch<'life0, 'life1, 'async_trait, T, R>(
        &'life0 self,
        method: &'life1 str,
        params: T,
    ) -> Pin<Box<dyn Future<Output = Result<R, Self::Error>> + Send + 'async_trait>>
       where T: Debug + Serialize + Send + Sync + 'async_trait,
             R: DeserializeOwned + Send + 'async_trait,
             Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

Trait which must be implemented by data transports to be used with the Neo JSON-RPC provider.

Required Associated Types§

Source

type Error: Into<ProviderError>

A JSON-RPC Error

Required Methods§

Source

fn fetch<'life0, 'life1, 'async_trait, T, R>( &'life0 self, method: &'life1 str, params: T, ) -> Pin<Box<dyn Future<Output = Result<R, Self::Error>> + Send + 'async_trait>>
where T: Debug + Serialize + Send + Sync + 'async_trait, R: DeserializeOwned + Send + 'async_trait, Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Sends a request with the provided JSON-RPC and parameters serialized as JSON

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.

Implementations on Foreign Types§

Source§

impl<'a, U: 'a + JsonRpcProvider + ?Sized> JsonRpcProvider for &'a U
where &'a U: Debug + Send + Sync,

Source§

type Error = <U as JsonRpcProvider>::Error

Source§

fn fetch<'life0, 'life1, 'async_trait, T, R>( &'life0 self, method: &'life1 str, params: T, ) -> Pin<Box<dyn Future<Output = Result<R, Self::Error>> + Send + 'async_trait>>
where T: Debug + Serialize + Send + Sync + 'async_trait, R: DeserializeOwned + Send + 'async_trait, Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source§

impl<U: JsonRpcProvider + ?Sized> JsonRpcProvider for Box<U>
where Box<U>: Debug + Send + Sync,

Source§

type Error = <U as JsonRpcProvider>::Error

Source§

fn fetch<'life0, 'life1, 'async_trait, T, R>( &'life0 self, method: &'life1 str, params: T, ) -> Pin<Box<dyn Future<Output = Result<R, Self::Error>> + Send + 'async_trait>>
where T: Debug + Serialize + Send + Sync + 'async_trait, R: DeserializeOwned + Send + 'async_trait, Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source§

impl<U: JsonRpcProvider + ?Sized> JsonRpcProvider for Arc<U>
where Arc<U>: Debug + Send + Sync,

Source§

type Error = <U as JsonRpcProvider>::Error

Source§

fn fetch<'life0, 'life1, 'async_trait, T, R>( &'life0 self, method: &'life1 str, params: T, ) -> Pin<Box<dyn Future<Output = Result<R, Self::Error>> + Send + 'async_trait>>
where T: Debug + Serialize + Send + Sync + 'async_trait, R: DeserializeOwned + Send + 'async_trait, Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Implementors§

Source§

impl JsonRpcProvider for HttpProvider

Source§

impl<Read, Write> JsonRpcProvider for RwClient<Read, Write>
where Read: JsonRpcProvider + 'static, <Read as JsonRpcProvider>::Error: Sync + Send + 'static + Display, Write: JsonRpcProvider + 'static, <Write as JsonRpcProvider>::Error: Sync + Send + 'static + Display,

Source§

type Error = RwClientError<Read, Write>

Source§

impl<T> JsonRpcProvider for RetryClient<T>
where T: JsonRpcProvider + 'static, T::Error: Sync + Send + 'static + Debug,