pub struct HttpRpcTransport { /* private fields */ }Expand description
An HTTP-based RpcTransport for nanorpc.
Implementations§
Source§impl HttpRpcTransport
impl HttpRpcTransport
Sourcepub fn new(remote: String) -> Self
pub fn new(remote: String) -> Self
Create a new HttpRpcTransport that goes to the given socket address over unencrypted HTTP/1.1. A default timeout is applied.
Currently, custom paths, HTTPS, etc are not supported.
Sourcepub fn new_with_proxy(remote: String, proxy: Proxy) -> Self
pub fn new_with_proxy(remote: String, proxy: Proxy) -> Self
Create a new HttpRpcTransport that goes to the given socket address over unencrypted HTTP/1.1. A default timeout is applied.
Currently, custom paths, HTTPS, etc are not supported.
Sourcepub fn set_timeout(&self, timeout: Option<Duration>)
pub fn set_timeout(&self, timeout: Option<Duration>)
Sets the timeout for this transport. If None, disables any timeout handling.
Trait Implementations§
Source§impl RpcTransport for HttpRpcTransport
impl RpcTransport for HttpRpcTransport
Source§type Error = Error
type Error = Error
This error type represents transport-level errors, like communication errors and such.
Source§fn call_raw<'life0, 'async_trait>(
&'life0 self,
req: JrpcRequest,
) -> Pin<Box<dyn Future<Output = Result<JrpcResponse, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn call_raw<'life0, 'async_trait>(
&'life0 self,
req: JrpcRequest,
) -> Pin<Box<dyn Future<Output = Result<JrpcResponse, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Sends an RPC call to the remote side, as a raw JSON-RPC request, receiving a raw JSON-RPC response.
Source§fn call<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
method: &'life1 str,
params: &'life2 [Value],
) -> Pin<Box<dyn Future<Output = Result<Option<Result<Value, ServerError>>, Self::Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
fn call<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
method: &'life1 str,
params: &'life2 [Value],
) -> Pin<Box<dyn Future<Output = Result<Option<Result<Value, ServerError>>, Self::Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
Sends an RPC call to the remote side, returning the result.
Ok(None) means that there is no transport-level error, but that the verb does not exist. This generally does not need a manual implementation.Auto Trait Implementations§
impl !Freeze for HttpRpcTransport
impl RefUnwindSafe for HttpRpcTransport
impl Send for HttpRpcTransport
impl Sync for HttpRpcTransport
impl Unpin for HttpRpcTransport
impl UnwindSafe for HttpRpcTransport
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