Struct alloy_rpc_client::ClientBuilder
source · 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 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.
Trait Implementations§
source§impl<L: Debug> Debug for ClientBuilder<L>
impl<L: Debug> Debug for ClientBuilder<L>
Auto Trait Implementations§
impl<L> Freeze for ClientBuilder<L>where
L: Freeze,
impl<L> RefUnwindSafe for ClientBuilder<L>where
L: RefUnwindSafe,
impl<L> Send for ClientBuilder<L>where
L: Send,
impl<L> Sync for ClientBuilder<L>where
L: Sync,
impl<L> Unpin for ClientBuilder<L>where
L: Unpin,
impl<L> UnwindSafe for ClientBuilder<L>where
L: UnwindSafe,
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