use std::io;
pub type Result<T> = std::result::Result<T, Error>;
#[derive(Debug, thiserror::Error)]
#[non_exhaustive]
pub enum Error {
#[error("network interface {0:?} not found")]
InterfaceNotFound(String),
#[error("failed to open packet socket: {0}")]
Socket(#[source] io::Error),
#[error("failed to bind packet socket to interface: {0}")]
Bind(#[source] io::Error),
#[error("failed to set socket option {option}: {source}")]
SetSockOpt {
option: &'static str,
#[source]
source: io::Error,
},
#[error("failed to mmap packet ring: {0}")]
Mmap(#[source] io::Error),
#[error("frame of {len} bytes exceeds maximum frame size of {max} bytes")]
FrameTooLarge {
len: usize,
max: usize,
},
#[error("invalid channel configuration: {0}")]
InvalidConfig(&'static str),
#[error(transparent)]
Io(#[from] io::Error),
}