pub struct RpcClient { /* private fields */ }Expand description
Connects gRPC clients using a common set of deadline and concurrency safeguards.
Implementations§
Source§impl RpcClient
impl RpcClient
pub fn new(config: RpcClientConfig) -> Self
pub fn try_new(config: RpcClientConfig) -> Result<Self, RpcConfigError>
pub fn config(&self) -> &RpcClientConfig
pub async fn connect(&self) -> Result<Channel, RpcClientError>
Sourcepub fn connect_service(
&self,
registry: &ServiceRegistry,
service: impl Into<String>,
) -> Result<Channel, RpcClientError>
pub fn connect_service( &self, registry: &ServiceRegistry, service: impl Into<String>, ) -> Result<Channel, RpcClientError>
Creates a channel that follows a service registry and balances calls across its endpoints.
Existing endpoints are installed before this method returns. A background task applies subsequent publications and withdrawals; it stops automatically when all channel clones have been dropped.
Sourcepub fn connect_discovered<S>(&self, subscription: S) -> Channelwhere
S: EndpointSubscription,
pub fn connect_discovered<S>(&self, subscription: S) -> Channelwhere
S: EndpointSubscription,
Creates a channel driven by any discovery backend that publishes complete snapshots.
Empty snapshots are supported and recover when endpoints appear. Malformed endpoints are ignored without poisoning the rest of a snapshot. The watcher exits when the discovery stream closes or all clones of the returned channel have been dropped.
Sourcepub fn connect_discovered_with_status<S>(
&self,
subscription: S,
) -> (Channel, DiscoveryStatus)where
S: EndpointSubscription,
pub fn connect_discovered_with_status<S>(
&self,
subscription: S,
) -> (Channel, DiscoveryStatus)where
S: EndpointSubscription,
Creates a weighted discovery channel and a watchable readiness handle.
Invalid endpoint URIs are excluded and make the snapshot degraded. When active health checking is configured, failed probes are removed until a later probe succeeds.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for RpcClient
impl RefUnwindSafe for RpcClient
impl Send for RpcClient
impl Sync for RpcClient
impl Unpin for RpcClient
impl UnsafeUnpin for RpcClient
impl UnwindSafe for RpcClient
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
Source§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::RequestSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request