Trait net::NetworkDevice
source · pub trait NetworkDevice: Send + Sync {
// Required methods
fn send(&mut self, buf: TransmitBuffer);
fn receive(&mut self) -> Option<ReceivedFrame>;
fn mac_address(&self) -> [u8; 6];
// Provided method
fn capabilities(&self) -> DeviceCapabilities { ... }
}
Expand description
A network device.
Devices implementing this trait can then be registered using
register_device
.
Users should not interact with this trait directly, but NetworkInterface
instead.
Required Methods§
sourcefn send(&mut self, buf: TransmitBuffer)
fn send(&mut self, buf: TransmitBuffer)
Sends a buffer on the device.
In the case of an error, the packet is dropped and the error is handled by the device driver.
sourcefn mac_address(&self) -> [u8; 6]
fn mac_address(&self) -> [u8; 6]
Returns the MAC address.
Provided Methods§
sourcefn capabilities(&self) -> DeviceCapabilities
fn capabilities(&self) -> DeviceCapabilities
Returns the device capabilities.