Skip to main content

VirtualMemoryError

Enum VirtualMemoryError 

Source
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

§what: &'static str

Which quantity was misaligned.

§value: usize

The value supplied.

§granularity: usize

This platform’s granularity.

§rounded: usize

The next legal value at or above value.

§

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

§operation: &'static str

Which call was being made when the lower layer refused.

§source: Box<dyn Error + Send + Sync>

The refusal itself, kept whole so it survives downcast_ref.

§

Os

The operating system refused the request.

Fields

§operation: &'static str

Which call failed.

§reason: String

What the OS reported.

§code: i32

The raw error code.

§

OutOfRange

A mapping would fall outside the reserved range.

Fields

§offset: usize

Where the caller asked to map.

§length: usize

How much.

§reserved: usize

The reservation’s size.

§overrun: usize

How far past the end it would reach.

§

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.

Fields

§offset: usize

The offset in question.

§

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.

Fields

§requested: String

What the caller asked to commit against.

§actual: String

What the pool is actually backed by.

Trait Implementations§

Source§

impl Debug for VirtualMemoryError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for VirtualMemoryError

Source§

fn fmt(&self, __formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Error for VirtualMemoryError

Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0:

use the Display impl or to_string()

1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl From<VirtualMemoryError> for VirtualBufferError

Source§

fn from(source: VirtualMemoryError) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> BindingResource for T
where T: Send + Sync + Debug,

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.