pub struct Client<P: Protocol> { /* private fields */ }Expand description
RPC client handle.
Implementations§
Source§impl<P: Protocol> Client<P>
impl<P: Protocol> Client<P>
Sourcepub fn is_same_session(&self, other: &Self) -> bool
pub fn is_same_session(&self, other: &Self) -> bool
Returns whether both clients refer to the same RPC session.
Sourcepub async fn close(self)
pub async fn close(self)
Gracefully closes the session.
This prevents new calls from being sent and completes all pending calls
with Error::ConnectionClosed. It then drains committed writes,
closes the outgoing transport, and waits for the peer to close its
outgoing transport. It affects every clone of this client handle.
This operation has no timeout. A peer that does not close its transport
can make it wait indefinitely; callers that need a bound should apply a
timeout and use Client::abort if the peer does not cooperate.
Windows named pipes do not support half-close, so after draining the
writer this closes the shared pipe instead of waiting for peer EOF.
Sourcepub async fn abort(self)
pub async fn abort(self)
Abruptly closes the session.
This prevents new calls from being sent, completes all pending calls
with Error::ConnectionClosed, and stops the reader without waiting
for the peer to close its transport. Committed writes are allowed to
finish their current fragments before the writer exits. It affects
every clone of this client handle.
Sourcepub fn call_with_trailer(&self, request: P::Request) -> TrailerSend<Call<P>>
pub fn call_with_trailer(&self, request: P::Request) -> TrailerSend<Call<P>>
Issue a call request with a byte trailer.
Write the trailer through the returned TrailerSend, then call
TrailerSend::finish to obtain the
Call. Dropping it sender without finishing aborts the trailer and
cancels the partially sent request.