pub struct Client<T: ?Sized> { /* private fields */ }Expand description
A client connection to a remote RPC server.
The magic: Client<dyn MyTrait> implements MyTrait, so you can call
client.method(args) directly.
Implementations§
Source§impl<T: ?Sized + 'static> Client<T>
impl<T: ?Sized + 'static> Client<T>
Sourcepub async fn call<Req: Serialize + Sync, Resp: DeserializeOwned>(
&self,
method_id: u16,
request: &Req,
) -> Result<Resp>
pub async fn call<Req: Serialize + Sync, Resp: DeserializeOwned>( &self, method_id: u16, request: &Req, ) -> Result<Resp>
Low-level call method used by generated trait impls. Sends a request and waits for a unary response.
Sourcepub async fn call_stream<Req: Serialize + Sync, Item: DeserializeOwned + Send + 'static>(
&self,
method_id: u16,
request: &Req,
) -> Result<RpcStream<Item>>
pub async fn call_stream<Req: Serialize + Sync, Item: DeserializeOwned + Send + 'static>( &self, method_id: u16, request: &Req, ) -> Result<RpcStream<Item>>
Start a streaming call. Returns a stream of responses.
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for Client<T>where
T: ?Sized,
impl<T> !RefUnwindSafe for Client<T>
impl<T> Send for Client<T>
impl<T> Sync for Client<T>
impl<T> Unpin for Client<T>
impl<T> !UnwindSafe for Client<T>
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