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§
fn send_frame(&mut self, data: &[u8]) -> Result<()>
Provided Methods§
Sourcefn send_frame_confirmed(&mut self, data: &[u8]) -> Result<()>
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.
fn send_frames(&mut self, frames: &[Vec<u8>]) -> Result<()>
Sourcefn flush(&mut self) -> Result<()>
fn flush(&mut self) -> Result<()>
Resume bytes accepted by a previous call that returned WouldBlock.
Sourcefn egress_control(&self) -> Option<EgressControl>
fn egress_control(&self) -> Option<EgressControl>
Share an exact byte admission budget with the async producer when this writer uses dataplane egress control.
fn shutdown(&mut self)
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".