pub trait ConnHandler<Rx, Tx> {
const DRAIN: bool = true;
// Provided methods
fn on_ingress(rx: Rx, res: Result<()>) -> impl Future<Output = ()> + Send { ... }
fn on_egress(tx: Tx, res: Result<()>) -> impl Future<Output = ()> + Send { ... }
}Expand description
Connection handler defines the connection I/O behavior.
It is mostly useful for transports that may require additional clean up not already covered
by AsyncWriteExt::shutdown, for example.
This API is experimental and may change in backwards-incompatible ways in the future.
Provided Associated Constants§
Sourceconst DRAIN: bool = true
const DRAIN: bool = true
Whether to keep reading once all Incoming handles are dropped until the peer closes
the stream, rather than aborting ingress and dropping the reader.
Any data received after all handles are dropped, or received for a registered path, which
was never indexed, fails ingress with std::io::ErrorKind::BrokenPipe.
Draining is required for transports that reset the connection when closed with
unread data, like TCP, discarding data not yet received by the peer.
Provided Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".