pub struct HttpTransport { /* private fields */ }Expand description
A JsonRpcTransport implementation that uses HTTP connections.
Implementations§
Source§impl HttpTransport
impl HttpTransport
Sourcepub fn new(url: impl Into<Url>) -> HttpTransport
pub fn new(url: impl Into<Url>) -> HttpTransport
Constructs HttpTransport from a JSON-RPC server URL, using default HTTP client settings.
To use custom HTTP settings (e.g. proxy, timeout), use
new_with_client instead.
Sourcepub fn new_with_client(url: impl Into<Url>, client: Client) -> HttpTransport
pub fn new_with_client(url: impl Into<Url>, client: Client) -> HttpTransport
Constructs HttpTransport from a JSON-RPC server URL and a custom reqwest client.
Sourcepub fn with_header(self, name: String, value: String) -> HttpTransport
pub fn with_header(self, name: String, value: String) -> HttpTransport
Consumes the current HttpTransport instance and returns a new one with the header
appended. Same as calling add_header.
Sourcepub fn add_header(&mut self, name: String, value: String)
pub fn add_header(&mut self, name: String, value: String)
Adds a custom HTTP header to be sent for requests.
Trait Implementations§
Source§impl Clone for HttpTransport
impl Clone for HttpTransport
Source§fn clone(&self) -> HttpTransport
fn clone(&self) -> HttpTransport
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for HttpTransport
impl Debug for HttpTransport
Source§impl JsonRpcTransport for HttpTransport
impl JsonRpcTransport for HttpTransport
Source§type Error = HttpTransportError
type Error = HttpTransportError
Possible errors processing requests.
Source§fn send_request<'life0, 'async_trait, P, R>(
&'life0 self,
method: JsonRpcMethod,
params: P,
) -> Pin<Box<dyn Future<Output = Result<JsonRpcResponse<R>, <HttpTransport as JsonRpcTransport>::Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
P: Serialize + Send + 'async_trait,
R: DeserializeOwned + Send + 'async_trait,
HttpTransport: 'async_trait,
fn send_request<'life0, 'async_trait, P, R>(
&'life0 self,
method: JsonRpcMethod,
params: P,
) -> Pin<Box<dyn Future<Output = Result<JsonRpcResponse<R>, <HttpTransport as JsonRpcTransport>::Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
P: Serialize + Send + 'async_trait,
R: DeserializeOwned + Send + 'async_trait,
HttpTransport: 'async_trait,
Sends a JSON-RPC request to retrieve a response.
Source§fn send_requests<'life0, 'async_trait, R>(
&'life0 self,
requests: R,
) -> Pin<Box<dyn Future<Output = Result<Vec<JsonRpcResponse<Value>>, <HttpTransport as JsonRpcTransport>::Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
R: AsRef<[ProviderRequestData]> + Send + Sync + 'async_trait,
HttpTransport: 'async_trait,
fn send_requests<'life0, 'async_trait, R>(
&'life0 self,
requests: R,
) -> Pin<Box<dyn Future<Output = Result<Vec<JsonRpcResponse<Value>>, <HttpTransport as JsonRpcTransport>::Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
R: AsRef<[ProviderRequestData]> + Send + Sync + 'async_trait,
HttpTransport: 'async_trait,
Sends multiple JSON-RPC requests in parallel.
Auto Trait Implementations§
impl Freeze for HttpTransport
impl !RefUnwindSafe for HttpTransport
impl Send for HttpTransport
impl Sync for HttpTransport
impl Unpin for HttpTransport
impl !UnwindSafe for HttpTransport
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more