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.


The name of this interface.

All addresses for this interface.

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).


impl Interface

Retrieve a list of all interfaces on this system.

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 = try!(Interface::get_by_name("lo"));
if let Some(ref lo) = iface {
} else {
    println!("Could not find loopback interface");

Returns whether this interface is up.

Returns whether this interface is a loopback address.

Retrieves the hardware address of this interface.

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.

Retrieve the MTU of this interface.

Trait Implementations

impl Debug for Interface

Formats the value using the given formatter.

impl PartialEq for Interface

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl Eq for Interface

impl Drop for Interface

A method called when the value goes out of scope. Read more