pub struct Client { /* private fields */ }Expand description
The client part of the endpoint.
This can be used to call RPCs and send notifications to the other end. There’s no direct constructor, it is created through the Endpoint.
Implementations§
Source§impl Client
impl Client
Sourcepub fn call(
self,
method: String,
params: Option<Value>,
timeout: Option<Duration>,
) -> RpcSent
pub fn call( self, method: String, params: Option<Value>, timeout: Option<Duration>, ) -> RpcSent
Call a RPC.
Construct an RPC message and send it to the other end. It returns a future that resolves once the message is sent. It yields the Client back (it is blocked for the time of sending) and another future that resolves once the answer is received (or once a timeout happens, in which case the result is None).
Sourcepub fn notify(self, method: String, params: Option<Value>) -> Notified
pub fn notify(self, method: String, params: Option<Value>) -> Notified
Send a notification.
It creates a notification message and sends it. It returs a future that resolves once the message is sent and yields the client back for further use.
Sourcepub fn server_ctl(&self) -> &ServerCtl
pub fn server_ctl(&self) -> &ServerCtl
Get the server control.
That allows terminating the server, etc.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Client
impl !RefUnwindSafe for Client
impl !Send for Client
impl !Sync for Client
impl Unpin for Client
impl !UnwindSafe for Client
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