mmap_rs_with_map_from_existing/
error.rs1use 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("trying to create Mmap from existing address but the address was not specified in MmapOptions")]
39 MissingAddressForExistingMap,
40
41 #[error(transparent)]
43 Io(#[from] std::io::Error),
44
45 #[error(transparent)]
47 ParseInt(#[from] std::num::ParseIntError),
48
49 #[error(transparent)]
51 Utf8(std::str::Utf8Error),
52
53 #[cfg(unix)]
54 #[error(transparent)]
56 Nix(#[from] nix::Error),
57
58 #[cfg(unix)]
59 #[error(transparent)]
61 Sysctl(#[from] sysctl::SysctlError),
62
63 #[cfg(any(target_os = "macos", target_os = "ios"))]
64 #[error("Mach kernel result = {0}")]
66 Mach(libc::c_int),
67
68 #[cfg(target_os = "windows")]
69 #[error(transparent)]
71 Windows(#[from] windows::core::Error),
72}