pub struct ClientBuilder<L> { /* private fields */ }
Expand description
A builder for the transport RpcClient
.
This is a wrapper around tower::ServiceBuilder
. It allows you to
configure middleware layers that will be applied to the transport, and has
some shortcuts for common layers and transports.
A builder accumulates Layers, and then is finished via the
ClientBuilder::connect
method, which produces an RPC client.
Implementations§
Source§impl<L> ClientBuilder<L>
impl<L> ClientBuilder<L>
Sourcepub fn layer<M>(self, layer: M) -> ClientBuilder<Stack<M, L>>
pub fn layer<M>(self, layer: M) -> ClientBuilder<Stack<M, L>>
Add a middleware layer to the stack.
This is a wrapper around tower::ServiceBuilder::layer
. Layers that
are added first will be called with the request first.
Sourcepub fn transport<T>(self, transport: T, is_local: bool) -> RpcClient<L::Service>
pub fn transport<T>(self, transport: T, is_local: bool) -> RpcClient<L::Service>
Create a new RpcClient
with the given transport and the configured
layers.
Sourcepub fn hyper_http(self, url: Url) -> RpcClient<L::Service>
Available on non-WebAssembly and crate feature hyper
only.
pub fn hyper_http(self, url: Url) -> RpcClient<L::Service>
hyper
only.Convenience function to create a new RpcClient
with a hyper
HTTP transport.
Sourcepub async fn pubsub<C>(
self,
pubsub_connect: C,
) -> TransportResult<RpcClient<L::Service>>
Available on crate feature pubsub
only.
pub async fn pubsub<C>( self, pubsub_connect: C, ) -> TransportResult<RpcClient<L::Service>>
pubsub
only.Connect a pubsub transport, producing an RpcClient
with the provided
connection.
Sourcepub async fn ws(
self,
ws_connect: WsConnect,
) -> TransportResult<RpcClient<L::Service>>
Available on crate feature ws
only.
pub async fn ws( self, ws_connect: WsConnect, ) -> TransportResult<RpcClient<L::Service>>
ws
only.Connect a WS transport, producing an RpcClient
with the provided
connection
Sourcepub async fn ipc<T>(
self,
ipc_connect: IpcConnect<T>,
) -> TransportResult<RpcClient<L::Service>>
Available on crate feature ipc
only.
pub async fn ipc<T>( self, ipc_connect: IpcConnect<T>, ) -> TransportResult<RpcClient<L::Service>>
ipc
only.Connect an IPC transport, producing an RpcClient
with the provided
connection.
Sourcepub async fn connect<C>(
self,
connect: C,
) -> TransportResult<RpcClient<L::Service>>
pub async fn connect<C>( self, connect: C, ) -> TransportResult<RpcClient<L::Service>>
Connect a transport, producing an RpcClient
with the provided
connection.
Sourcepub async fn connect_boxed<C>(
self,
connect: C,
) -> TransportResult<RpcClient<L::Service>>
pub async fn connect_boxed<C>( self, connect: C, ) -> TransportResult<RpcClient<L::Service>>
Connect a transport, producing an RpcClient
with a BoxTransport
connection.