pub trait Device {
// Required methods
fn kind(&self) -> DeviceKind;
fn read_frame(&mut self, buf: &mut [u8]) -> Result<usize>;
fn write_frame(&mut self, frame: &[u8]) -> Result<usize>;
}Expand description
A tunnel endpoint that yields and accepts inner frames. Implemented in M4.
Required Methods§
Sourcefn kind(&self) -> DeviceKind
fn kind(&self) -> DeviceKind
Whether this is an L3 (TUN) or L2 (TAP) device.
Sourcefn read_frame(&mut self, buf: &mut [u8]) -> Result<usize>
fn read_frame(&mut self, buf: &mut [u8]) -> Result<usize>
Read one inner frame into buf, returning its length.
Sourcefn write_frame(&mut self, frame: &[u8]) -> Result<usize>
fn write_frame(&mut self, frame: &[u8]) -> Result<usize>
Write one inner frame, returning the number of bytes written.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".