pub struct RpcClient { /* private fields */ }Expand description
Client for making requests to Batata/Nacos server
Implementations§
Source§impl RpcClient
impl RpcClient
Sourcepub fn with_namespace(self, namespace: &str) -> Self
pub fn with_namespace(self, namespace: &str) -> Self
Set namespace
Sourcepub fn with_app_name(self, app_name: &str) -> Self
pub fn with_app_name(self, app_name: &str) -> Self
Set app name
Sourcepub fn with_labels(self, labels: HashMap<String, String>) -> Self
pub fn with_labels(self, labels: HashMap<String, String>) -> Self
Set labels
Sourcepub fn with_timeout(self, timeout_ms: u64) -> Self
pub fn with_timeout(self, timeout_ms: u64) -> Self
Set timeout
Sourcepub fn with_retry(self, retry_times: u32) -> Self
pub fn with_retry(self, retry_times: u32) -> Self
Set retry times
Sourcepub fn is_connected(&self) -> bool
pub fn is_connected(&self) -> bool
Check if connected
Sourcepub fn connection_id(&self) -> Option<String>
pub fn connection_id(&self) -> Option<String>
Get connection ID
Sourcepub async fn request<Req, Resp>(&self, request: &Req) -> Result<Resp>where
Req: RequestTrait + Serialize + Clone,
Resp: for<'de> Deserialize<'de> + Default + ResponseTrait,
pub async fn request<Req, Resp>(&self, request: &Req) -> Result<Resp>where
Req: RequestTrait + Serialize + Clone,
Resp: for<'de> Deserialize<'de> + Default + ResponseTrait,
Send request with retry
Sourcepub async fn send(&self, payload: Payload) -> Result<()>
pub async fn send(&self, payload: Payload) -> Result<()>
Send request without retry (for fire-and-forget)
Sourcepub fn connection(&self) -> Option<Arc<GrpcConnection>>
pub fn connection(&self) -> Option<Arc<GrpcConnection>>
Get the current connection
Sourcepub async fn unary_request<Req, Resp>(&self, request: &Req) -> Result<Resp>
pub async fn unary_request<Req, Resp>(&self, request: &Req) -> Result<Resp>
Simple unary request without connection state
Auto Trait Implementations§
impl Freeze for RpcClient
impl !RefUnwindSafe for RpcClient
impl Send for RpcClient
impl Sync for RpcClient
impl Unpin for RpcClient
impl !UnwindSafe for RpcClient
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§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> 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