use nix;
use std::{ffi, io, result};
use thiserror::Error;
#[derive(Error, Debug)]
pub enum Error {
#[error("{0}")]
Io(#[from] io::Error),
#[error("{0}")]
NulError(#[from] ffi::NulError),
#[error("{0}")]
Nix(#[from] nix::Error),
#[error("Wrong data type")]
WrongDataType,
#[error("Bad return size")]
BadReturnSize,
#[error("Invalid index")]
InvalidIndex,
#[error("{0}")]
General(String),
}
pub type Result<T> = result::Result<T, Error>;
impl From<nix::errno::Errno> for Error {
fn from(err: nix::errno::Errno) -> Self {
nix::Error::Sys(err).into()
}
}