inherface 0.3.1

Retrieve a system's Network Interfaces on Linux
Documentation
use std::string::FromUtf8Error;

/// Errors for this library
#[derive(thiserror::Error, Debug)]
pub enum Error {
    /// An error during libc::getifaddrs
    #[error("Failed to execute `{0}`. Received error code `{1}`")]
    GetIfAddrsError(String, i32),
    /// Error when parsing the interface name to a valid utf8 String
    #[error("Failed to parse bytes into UTF-8 characters. `{0}`")]
    ParseUtf8Error(FromUtf8Error),
}

impl From<FromUtf8Error> for Error {
    fn from(error: FromUtf8Error) -> Self {
        Error::ParseUtf8Error(error)
    }
}

/// Wraps standard library Result with custom Error enum
pub type Result<T> = std::result::Result<T, Error>;