pub struct Interface { /* private fields */ }
Expand description
Represents a network interface.
Wraps pnet’s NetworkInterface
struct for better convenience.
Implementations§
Source§impl Interface
impl Interface
Sourcepub fn new_by_name(interface_name: &str) -> Option<Self>
pub fn new_by_name(interface_name: &str) -> Option<Self>
Selects the interface with the name interface_name
.
Sourcepub fn get_mac(&self) -> Result<MacAddr, Error>
pub fn get_mac(&self) -> Result<MacAddr, Error>
Returns the MAC address assigned to the interface.
Sourcepub fn get_raw_interface(&self) -> &NetworkInterface
pub fn get_raw_interface(&self) -> &NetworkInterface
Returns the raw pnet
interface instance related to the interface.
Sourcepub fn create_tx_rx_channels(
&self,
) -> Result<(Box<dyn DataLinkSender>, Box<dyn DataLinkReceiver>), Error>
pub fn create_tx_rx_channels( &self, ) -> Result<(Box<dyn DataLinkSender>, Box<dyn DataLinkReceiver>), Error>
Creates and returns a new Ethernet (tx, rx) channel pair on the interface.
Trait Implementations§
impl Eq for Interface
impl StructuralPartialEq for Interface
Auto Trait Implementations§
impl Freeze for Interface
impl RefUnwindSafe for Interface
impl Send for Interface
impl Sync for Interface
impl Unpin for Interface
impl UnwindSafe for Interface
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more