pub struct Interface { /* private fields */ }Expand description
A network interface
Implementations§
Source§impl Interface
impl Interface
Sourcepub fn from_name(name: &str) -> Result<Self, Error>
pub fn from_name(name: &str) -> Result<Self, Error>
Creates an interface from the name
§Errors
Returns Error::InvalidInterfaceName if the name is invalid.
Sourcepub fn from_index(index: u32) -> Result<Self, Error>
pub fn from_index(index: u32) -> Result<Self, Error>
Creates an interface from the index
§Errors
Returns Error::InvalidInterfaceIndex if the index is invalid.
Returns Error::InvalidInterfaceName if the name is invalid.
§Panics
Panics if the interface name is not a valid string
Sourcepub fn frame_kind(&self) -> Result<FrameKind, Error>
pub fn frame_kind(&self) -> Result<FrameKind, Error>
Returns the interfaces FrameKind. This is needed because most interfaces receive
ethernet frames, while wireguard interfaces receive IP frames.
§Errors
Returns Error::InvalidFrameKind if the FrameKind is not FrameKind::Eth or
FrameKind::Ip.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Interface
impl RefUnwindSafe for Interface
impl Send for Interface
impl Sync for Interface
impl Unpin for Interface
impl UnsafeUnpin 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