Skip to main content

Writer

Trait Writer 

Source
pub trait Writer: Send {
    // Required method
    fn send_frame(&mut self, data: &[u8]) -> Result<()>;

    // Provided methods
    fn send_frame_confirmed(&mut self, data: &[u8]) -> Result<()> { ... }
    fn send_frames(&mut self, frames: &[Vec<u8>]) -> Result<()> { ... }
    fn flush(&mut self) -> Result<()> { ... }
    fn egress_control(&self) -> Option<EgressControl> { ... }
    fn shutdown(&mut self) { ... }
}
Expand description

Writable end of an interface. Held by the driver.

Each implementation wraps a socket + framing.

Required Methods§

Source

fn send_frame(&mut self, data: &[u8]) -> Result<()>

Provided Methods§

Source

fn send_frame_confirmed(&mut self, data: &[u8]) -> Result<()>

Write one frame without silently dropping it. WouldBlock means the frame was accepted and flush must finish it before success is reported. Writers with intentional drop policies must override this method.

Source

fn send_frames(&mut self, frames: &[Vec<u8>]) -> Result<()>

Source

fn flush(&mut self) -> Result<()>

Resume bytes accepted by a previous call that returned WouldBlock.

Source

fn egress_control(&self) -> Option<EgressControl>

Share an exact byte admission budget with the async producer when this writer uses dataplane egress control.

Source

fn shutdown(&mut self)

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§