pub enum VirtualMemoryError {
Misaligned {
what: &'static str,
value: usize,
granularity: usize,
rounded: usize,
},
Delegated {
operation: &'static str,
source: Box<dyn Error + Send + Sync>,
},
Os {
operation: &'static str,
reason: String,
code: i32,
},
OutOfRange {
offset: usize,
length: usize,
reserved: usize,
overrun: usize,
},
AlreadyMapped {
offset: usize,
},
LocationMismatch {
requested: String,
actual: String,
},
}Expand description
Why a virtual range could not be reserved, mapped, or unmapped.
Not Clone/PartialEq: a refusal that carries the cause underneath it
cannot be meaningfully duplicated or compared, and keeping the cause is
worth more than either.
Variants§
Misaligned
The requested size or offset is not a multiple of the mapping granularity.
Reported rather than rounded, because silently rounding an offset would place a block somewhere the caller did not ask for and every subsequent read would be of the wrong data.
Fields
Delegated
A layer this call delegated to refused the request.
Distinct from VirtualMemoryError::Os, which means the kernel
refused it. Keeping the two apart matters because they call for
opposite responses: a governor that declines a reservation is telling
the caller to ask for less or free something first, while a driver that
fails a mapping is telling it that the request cannot be served at all.
Flattening a decision into an OS error also has to invent an errno,
and os error 0 in a log sends the next reader hunting for a kernel
fault that never happened.
The refusal is kept whole rather than stringified so callers can still match on it after it has crossed this boundary.
Fields
Os
The operating system refused the request.
Fields
OutOfRange
A mapping would fall outside the reserved range.
Fields
AlreadyMapped
The range is already mapped at that offset.
Replacing a live mapping silently would leave the previous block allocated but unreachable, so it is refused.
LocationMismatch
A caller-supplied PhysicalLocation (or platform-specific stand-in for
it) did not match the physical backing a pool/handle actually holds.
Rejected before any lease charge, handle acquisition, mapping, or accounting mutation happens: this is a caller-programming-error check, not a driver refusal, and must not have any side effect on the pool it was refused against.
Trait Implementations§
Source§impl Debug for VirtualMemoryError
impl Debug for VirtualMemoryError
Source§impl Display for VirtualMemoryError
impl Display for VirtualMemoryError
Source§impl Error for VirtualMemoryError
impl Error for VirtualMemoryError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()