Skip to main content

Sink

Trait Sink 

Source
pub trait Sink {
    // Required method
    fn write(&mut self, conn: ConnId, bytes: &[u8]) -> usize;

    // Provided method
    fn closed(&mut self, conn: ConnId) { ... }
}
Expand description

Where replies go.

One call per connection per batch, with however many replies are waiting. The network reactor implements this over io_uring, a test implements it over a Vec, and neither this module nor dispatch has to know which.

Required Methods§

Source

fn write(&mut self, conn: ConnId, bytes: &[u8]) -> usize

Take up to all of bytes for conn, and say how many were taken.

Fewer than were offered means the socket is full: what is left stays in the connection’s reply buffer and is offered again on the next flush.

Provided Methods§

Source

fn closed(&mut self, conn: ConnId)

The connection is finished with and its id is about to be reused.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§