Struct interfaces::Interface [−][src]
pub struct Interface { pub name: String, pub addresses: Vec<Address>, pub flags: InterfaceFlags, // some fields omitted }
The Interface
structure represents a single interface on the system. It also contains
methods to control the interface.
Fields
name: String
The name of this interface.
addresses: Vec<Address>
All addresses for this interface.
flags: InterfaceFlags
Interface flags.
NOTE: The underlying API returns this value for each address of an interface, not each interface itself. We assume that they are all equal and take the first set of flags (from the first address).
Implementations
impl Interface
[src]
pub fn get_all() -> Result<Vec<Interface>>
[src]
Retrieve a list of all interfaces on this system.
pub fn get_by_name(name: &str) -> Result<Option<Interface>>
[src]
Returns an Interface
instance representing the interface with the given name. Will
return Ok(Some(Interface))
on success, Ok(None)
if there is no such interface, and
Err(..)
on failure.
let iface = Interface::get_by_name("lo")?; if let Some(ref lo) = iface { assert!(lo.is_loopback()); } else { println!("Could not find loopback interface"); }
pub fn is_up(&self) -> bool
[src]
Returns whether this interface is up.
pub fn is_running(&self) -> bool
[src]
Returns whether this interface is ready for transfer.
pub fn is_loopback(&self) -> bool
[src]
Returns whether this interface is a loopback address.
pub fn hardware_addr(&self) -> Result<HardwareAddr>
[src]
Retrieves the hardware address of this interface.
pub fn set_up(&mut self, up: bool) -> Result<()>
[src]
Sets the interface as up or down. This will change the status of the given interface in
the system, and update the flags of this Interface
instance.
pub fn get_mtu(&self) -> Result<u32>
[src]
Retrieve the MTU of this interface.
Trait Implementations
impl Debug for Interface
[src]
impl Drop for Interface
[src]
impl Eq for Interface
[src]
impl PartialEq<Interface> for Interface
[src]
Auto Trait Implementations
impl RefUnwindSafe for Interface
impl Send for Interface
impl Sync for Interface
impl Unpin for Interface
impl UnwindSafe for Interface
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,