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 fn hyper_http(self, url: Url) -> RpcClient
Available on non-WebAssembly and crate feature hyper only.
pub fn hyper_http(self, url: Url) -> RpcClient
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>
Available on crate feature pubsub only.
pub async fn pubsub<C>(self, pubsub_connect: C) -> TransportResult<RpcClient>
pubsub only.Connect a pubsub transport, producing an RpcClient with the provided
connection.
Sourcepub async fn ws(self, ws_connect: WsConnect) -> TransportResult<RpcClient>
Available on crate feature ws only.
pub async fn ws(self, ws_connect: WsConnect) -> TransportResult<RpcClient>
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>
Available on crate feature ipc only.
pub async fn ipc<T>( self, ipc_connect: IpcConnect<T>, ) -> TransportResult<RpcClient>
ipc only.Connect an IPC transport, producing an RpcClient with the provided
connection.
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.
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
Source§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
Source§fn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Source§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
Source§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
Source§fn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
impl<T> ErasedDestructor for Twhere
T: 'static,
impl<T> MaybeSendSync for T
Layout§
Note: Unable to compute type layout, possibly due to this type having generic parameters. Layout can only be computed for concrete, fully-instantiated types.