1use crate::UnsafeMmapFlags;
4use thiserror::Error;
5
6#[derive(Debug, Error)]
8pub enum Error {
9 #[error("{0:?} must be set")]
11 UnsafeFlagNeeded(UnsafeMmapFlags),
12
13 #[error("invalid size")]
15 InvalidSize,
16
17 #[error("invalid offset")]
19 InvalidOffset,
20
21 #[error("invalid operation")]
23 InvalidOperation,
24
25 #[error("the memory maps must be adjacent")]
27 MustBeAdjacent,
28
29 #[error("the memory maps must share the same attributes")]
31 AttributeMismatch,
32
33 #[error("the memory maps must share the same backing")]
35 BackingMismatch,
36
37 #[error(transparent)]
39 Io(#[from] std::io::Error),
40
41 #[error(transparent)]
43 ParseInt(#[from] std::num::ParseIntError),
44
45 #[error(transparent)]
47 Utf8(std::str::Utf8Error),
48
49 #[cfg(unix)]
50 #[error(transparent)]
52 Nix(#[from] nix::Error),
53
54 #[cfg(unix)]
55 #[error(transparent)]
57 Sysctl(#[from] sysctl::SysctlError),
58
59 #[cfg(any(target_os = "macos", target_os = "ios"))]
60 #[error("Mach kernel result = {0}")]
62 Mach(libc::c_int),
63
64 #[cfg(target_os = "windows")]
65 #[error(transparent)]
67 Windows(#[from] windows::core::Error),
68}