Skip to main content

Module duplex

Module duplex 

Source
Expand description

Duplex channel API: a single connection carries messages in both directions.

Structs§

DuplexClient
A handle to a duplex client session: wraps the send/recv halves and the spawned task driving the connection. Owns a cancellation token so callers can deterministically stop the recv/send loop via DuplexClient::join.
DuplexRx
Receiver half of a duplex channel.
DuplexServer
Public duplex server that yields (DuplexRx<In>, DuplexTx<Out>) pairs.
DuplexTx
Sender half of a duplex channel.

Functions§

dial
Connect to a duplex server. Returns a DuplexClient wrapping the send/recv halves and the spawned recv/send task; callers use DuplexClient::tx / DuplexClient::take_rx to extract the halves and DuplexClient::join to deterministically shut the session down.
serve
Start a duplex server on the given address.