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
pub fn transport<T>(self, transport: T, is_local: bool) -> RpcClient
Create a new RpcClient
with the given transport and the configured
layers.
This collapses the tower::ServiceBuilder
with the given transport via
tower::ServiceBuilder::service
.
Sourcepub async fn connect(self, s: &str) -> TransportResult<RpcClient>
pub async fn connect(self, s: &str) -> TransportResult<RpcClient>
Connect a transport specified by the given string, producing an RpcClient
.
See BuiltInConnectionString
for more information.
Sourcepub async fn connect_with<C>(self, connect: C) -> TransportResult<RpcClient>
pub async fn connect_with<C>(self, connect: C) -> TransportResult<RpcClient>
Connect a transport, producing an RpcClient
.
Sourcepub async fn connect_boxed<C>(self, connect: C) -> TransportResult<RpcClient>
👎Deprecated since 0.9.0: RpcClient is now always boxed, use connect_with
instead
pub async fn connect_boxed<C>(self, connect: C) -> TransportResult<RpcClient>
connect_with
insteadConnect a transport, producing an RpcClient
with a BoxTransport
connection.