sinf 0.1.0

Library for obtaining in-depth system information at both the hardware and software levels
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use crate::InterfaceOperationalState;

impl InterfaceOperationalState {
    pub(crate) fn from_data(data: &[u8]) -> Self {
        // See the /sys/class/net/<iface>/operstate section of the kernel ABI docs.
        match data {
            b"unknown" => Self::Unknown,
            b"notpresent" => Self::NotPresent,
            b"down" => Self::Down,
            b"lowerlayerdown" => Self::LowerLayerDown,
            b"testing" => Self::Testing,
            b"dormant" => Self::Dormant,
            b"up" => Self::Up,
            _ => Self::Other,
        }
    }
}