pub struct Client<P: Protocol> { /* private fields */ }Expand description
Cheap shared handle to one reader, writer, allocator, and set of subscriptions.
Implementations§
Source§impl<P: Protocol> Client<P>
impl<P: Protocol> Client<P>
Sourcepub async fn connect(path: impl AsRef<Path>) -> ClientResult<Self>
pub async fn connect(path: impl AsRef<Path>) -> ClientResult<Self>
Connect a native endpoint with a single total setup deadline.
Sourcepub async fn connect_with(
path: impl AsRef<Path>,
configure: impl FnOnce(ConnectOptions) -> ConnectOptions,
) -> ClientResult<Self>
pub async fn connect_with( path: impl AsRef<Path>, configure: impl FnOnce(ConnectOptions) -> ConnectOptions, ) -> ClientResult<Self>
Configure a native connection without modifying its endpoint name.
Sourcepub async fn connect_connector(connector: &dyn Connector) -> ClientResult<Self>
pub async fn connect_connector(connector: &dyn Connector) -> ClientResult<Self>
Connect through a supplied repeatable dialer.
Sourcepub async fn connect_connector_with(
connector: &dyn Connector,
configure: impl FnOnce(ConnectOptions) -> ConnectOptions,
) -> ClientResult<Self>
pub async fn connect_connector_with( connector: &dyn Connector, configure: impl FnOnce(ConnectOptions) -> ConnectOptions, ) -> ClientResult<Self>
Configure one deadline covering both dial and protocol establishment.
Sourcepub async fn connect_stream(stream: impl ByteTransport) -> ClientResult<Self>
pub async fn connect_stream(stream: impl ByteTransport) -> ClientResult<Self>
Establish the protocol on an exclusively owned caller transport.
Sourcepub async fn connect_stream_with(
stream: impl ByteTransport,
configure: impl FnOnce(ConnectOptions) -> ConnectOptions,
) -> ClientResult<Self>
pub async fn connect_stream_with( stream: impl ByteTransport, configure: impl FnOnce(ConnectOptions) -> ConnectOptions, ) -> ClientResult<Self>
Configure setup for an already-dialed owned transport.
Sourcepub async fn from_established(
established: Established<P::Ready>,
) -> ClientResult<Self>
pub async fn from_established( established: Established<P::Ready>, ) -> ClientResult<Self>
Start routing after external protocol setup, validating ranges and limits.
Sourcepub async fn closed(&self)
pub async fn closed(&self)
Wait for shared closure, including an idle peer disconnect. Cancellation of this wait does not close the connection or affect other callers.
Sourcepub async fn close(&self)
pub async fn close(&self)
Close all shared handles and wake every waiter; never reconnect implicitly.
Sourcepub async fn request<M: IntoOutboundMessage<P>>(
&self,
message: M,
) -> ClientResult<Message>
pub async fn request<M: IntoOutboundMessage<P>>( &self, message: M, ) -> ClientResult<Message>
Return the first response and retain drain state if it is nonterminal.
Sourcepub async fn request_with<M: IntoOutboundMessage<P>>(
&self,
message: M,
configure: impl FnOnce(RequestOptions) -> RequestOptions,
) -> ClientResult<Message>
pub async fn request_with<M: IntoOutboundMessage<P>>( &self, message: M, configure: impl FnOnce(RequestOptions) -> RequestOptions, ) -> ClientResult<Message>
Configure a local unary wait without imposing application success rules.
Sourcepub async fn request_typed<R: Request<P>>(
&self,
request: &R,
) -> Result<R::Response, R::Error>
pub async fn request_typed<R: Request<P>>( &self, request: &R, ) -> Result<R::Response, R::Error>
Execute a borrowed prepared request with optional checked result decoding.
Sourcepub async fn request_typed_with<R: Request<P>>(
&self,
request: &R,
configure: impl FnOnce(RequestOptions) -> RequestOptions,
) -> Result<R::Response, R::Error>
pub async fn request_typed_with<R: Request<P>>( &self, request: &R, configure: impl FnOnce(RequestOptions) -> RequestOptions, ) -> Result<R::Response, R::Error>
Configure one checked unary attempt; unexpected streaming is an error.
Sourcepub async fn stream<M: IntoOutboundMessage<P>>(
&self,
message: M,
) -> ClientResult<Stream<P>>
pub async fn stream<M: IntoOutboundMessage<P>>( &self, message: M, ) -> ClientResult<Stream<P>>
Open a message stream on an owned correlation ID.
Sourcepub async fn stream_with<M: IntoOutboundMessage<P>>(
&self,
message: M,
configure: impl FnOnce(RequestOptions) -> RequestOptions,
) -> ClientResult<Stream<P>>
pub async fn stream_with<M: IntoOutboundMessage<P>>( &self, message: M, configure: impl FnOnce(RequestOptions) -> RequestOptions, ) -> ClientResult<Stream<P>>
Configure the stream-opening wait; subsequent receives own their lifetime.
Sourcepub async fn request_raw(
&self,
flags: u8,
body: Vec<u8>,
) -> ClientResult<RawFrame>
pub async fn request_raw( &self, flags: u8, body: Vec<u8>, ) -> ClientResult<RawFrame>
Return one raw frame without decoding or normalizing its envelope.
Sourcepub async fn request_raw_with(
&self,
flags: u8,
body: Vec<u8>,
configure: impl FnOnce(RequestOptions) -> RequestOptions,
) -> ClientResult<RawFrame>
pub async fn request_raw_with( &self, flags: u8, body: Vec<u8>, configure: impl FnOnce(RequestOptions) -> RequestOptions, ) -> ClientResult<RawFrame>
Set a deadline covering queue admission, write completion, and reply wait.
Sourcepub async fn stream_raw(
&self,
flags: u8,
body: Vec<u8>,
) -> ClientResult<RawStream<P>>
pub async fn stream_raw( &self, flags: u8, body: Vec<u8>, ) -> ClientResult<RawStream<P>>
Open an opaque stream with the same ID lease as native message streams.
Sourcepub async fn stream_raw_with(
&self,
flags: u8,
body: Vec<u8>,
configure: impl FnOnce(RequestOptions) -> RequestOptions,
) -> ClientResult<RawStream<P>>
pub async fn stream_raw_with( &self, flags: u8, body: Vec<u8>, configure: impl FnOnce(RequestOptions) -> RequestOptions, ) -> ClientResult<RawStream<P>>
Configure opaque stream opening without inspecting its envelope.
Sourcepub async fn send<M: IntoOutboundMessage<P>>(
&self,
id: u32,
message: M,
) -> ClientResult<()>
pub async fn send<M: IntoOutboundMessage<P>>( &self, id: u32, message: M, ) -> ClientResult<()>
Send a native or encoded payload on a currently live owned ID.
Sourcepub async fn send_raw(
&self,
id: u32,
flags: u8,
body: &[u8],
) -> ClientResult<()>
pub async fn send_raw( &self, id: u32, flags: u8, body: &[u8], ) -> ClientResult<()>
Send an opaque envelope on a currently live owned ID.
Sourcepub async fn write_unchecked(&self, packet: Vec<u8>) -> ClientResult<()>
pub async fn write_unchecked(&self, packet: Vec<u8>) -> ClientResult<()>
Serialize exact packet bytes without allocating an ID or subscription. The caller owns packet semantics; byte limits and shared close still apply.