nix::net::if_

Function if_nameindex

source
pub fn if_nameindex() -> Result<Interfaces>
Expand description

Retrieve a list of the network interfaces available on the local system.

let interfaces = nix::net::if_::if_nameindex().unwrap();
for iface in &interfaces {
    println!("Interface #{} is called {}", iface.index(), iface.name().to_string_lossy());
}