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§

source

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.

source

fn receive(&mut self) -> Option<ReceivedFrame>

Receives a frame from the device.

source

fn mac_address(&self) -> [u8; 6]

Returns the MAC address.

Provided Methods§

source

fn capabilities(&self) -> DeviceCapabilities

Returns the device capabilities.

Implementors§