pub struct RpcClient { /* private fields */ }Available on crate feature
client only.Expand description
Convenient type alias for BaseRpcClient
This is the main RPC client type for making service calls.
§Example
use zus_rs::RpcClient;
// Connect via TCP
let client = RpcClient::new("tcp://localhost:9527").await?;
// Or via ZooServer discovery
let client = RpcClient::new("zns://localhost:9528/zus/services/myservice/").await?;Base RPC Client implementation
Implementations§
Source§impl BaseRpcClient
impl BaseRpcClient
Sourcepub async fn new_with_pooling(
server_path: &str,
pool_config: ConnectionPoolConfig,
) -> Result<BaseRpcClient, ZusError>
pub async fn new_with_pooling( server_path: &str, pool_config: ConnectionPoolConfig, ) -> Result<BaseRpcClient, ZusError>
Sourcepub fn builder() -> BaseRpcClientBuilder
pub fn builder() -> BaseRpcClientBuilder
Create a builder for more advanced configuration
Sourcepub async fn for_gateway(server_path: &str) -> Result<BaseRpcClient, ZusError>
pub async fn for_gateway(server_path: &str) -> Result<BaseRpcClient, ZusError>
pub fn enable_load_balance(&mut self)
pub fn disable_load_balance(&mut self)
Sourcepub fn is_pooling_enabled(&self) -> bool
pub fn is_pooling_enabled(&self) -> bool
Check if connection pooling is enabled
Trait Implementations§
Source§impl ZusRpcClient for BaseRpcClient
impl ZusRpcClient for BaseRpcClient
Auto Trait Implementations§
impl !Freeze for BaseRpcClient
impl !RefUnwindSafe for BaseRpcClient
impl Send for BaseRpcClient
impl Sync for BaseRpcClient
impl Unpin for BaseRpcClient
impl !UnwindSafe for BaseRpcClient
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
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>
Wrap the input message
T in a tonic::Request