use crate::UnsafeMmapFlags;
use thiserror::Error;
#[derive(Debug, Error)]
pub enum Error {
#[error("{0:?} must be set")]
UnsafeFlagNeeded(UnsafeMmapFlags),
#[error("invalid size")]
InvalidSize,
#[error("invalid offset")]
InvalidOffset,
#[error("invalid operation")]
InvalidOperation,
#[error("the memory maps must be adjacent")]
MustBeAdjacent,
#[error("the memory maps must share the same attributes")]
AttributeMismatch,
#[error("the memory maps must share the same backing")]
BackingMismatch,
#[error(transparent)]
Io(#[from] std::io::Error),
#[error(transparent)]
ParseInt(#[from] std::num::ParseIntError),
#[error(transparent)]
Utf8(std::str::Utf8Error),
#[cfg(unix)]
#[error(transparent)]
Nix(#[from] nix::Error),
#[cfg(unix)]
#[error(transparent)]
Sysctl(#[from] sysctl::SysctlError),
#[cfg(any(target_os = "macos", target_os = "ios"))]
#[error("Mach kernel result = {0}")]
Mach(libc::c_int),
#[cfg(target_os = "windows")]
#[error(transparent)]
Windows(#[from] windows::core::Error),
}