Struct uefi::Status

source ·
#[repr(transparent)]
pub struct Status(pub usize);
Expand description

UEFI uses status codes in order to report successes, errors, and warnings.

Unfortunately, the spec allows and encourages implementation-specific non-portable status codes. Therefore, these cannot be modeled as a Rust enum, as injecting an unknown value in a Rust enum is undefined behaviour.

For lack of a better option, we therefore model them as a newtype of usize.

For a convenient integration into the Rust ecosystem, there are multiple factory methods to convert a Status into a uefi::Result:

Tuple Fields§

§0: usize

Implementations§

source§

impl Status

source

pub const SUCCESS: Status = _

The operation completed successfully.

source

pub const WARN_UNKNOWN_GLYPH: Status = _

The string contained characters that could not be rendered and were skipped.

source

pub const WARN_DELETE_FAILURE: Status = _

The handle was closed, but the file was not deleted.

source

pub const WARN_WRITE_FAILURE: Status = _

The handle was closed, but the data to the file was not flushed properly.

source

pub const WARN_BUFFER_TOO_SMALL: Status = _

The resulting buffer was too small, and the data was truncated.

source

pub const WARN_STALE_DATA: Status = _

The data has not been updated within the timeframe set by local policy.

source

pub const WARN_FILE_SYSTEM: Status = _

The resulting buffer contains UEFI-compliant file system.

source

pub const WARN_RESET_REQUIRED: Status = _

The operation will be processed across a system reset.

source

pub const LOAD_ERROR: Status = _

The image failed to load.

source

pub const INVALID_PARAMETER: Status = _

A parameter was incorrect.

source

pub const UNSUPPORTED: Status = _

The operation is not supported.

source

pub const BAD_BUFFER_SIZE: Status = _

The buffer was not the proper size for the request.

source

pub const BUFFER_TOO_SMALL: Status = _

The buffer is not large enough to hold the requested data. The required buffer size is returned in the appropriate parameter.

source

pub const NOT_READY: Status = _

There is no data pending upon return.

source

pub const DEVICE_ERROR: Status = _

The physical device reported an error while attempting the operation.

source

pub const WRITE_PROTECTED: Status = _

The device cannot be written to.

source

pub const OUT_OF_RESOURCES: Status = _

A resource has run out.

source

pub const VOLUME_CORRUPTED: Status = _

An inconstency was detected on the file system.

source

pub const VOLUME_FULL: Status = _

There is no more space on the file system.

source

pub const NO_MEDIA: Status = _

The device does not contain any medium to perform the operation.

source

pub const MEDIA_CHANGED: Status = _

The medium in the device has changed since the last access.

source

pub const NOT_FOUND: Status = _

The item was not found.

source

pub const ACCESS_DENIED: Status = _

Access was denied.

source

pub const NO_RESPONSE: Status = _

The server was not found or did not respond to the request.

source

pub const NO_MAPPING: Status = _

A mapping to a device does not exist.

source

pub const TIMEOUT: Status = _

The timeout time expired.

source

pub const NOT_STARTED: Status = _

The protocol has not been started.

source

pub const ALREADY_STARTED: Status = _

The protocol has already been started.

source

pub const ABORTED: Status = _

The operation was aborted.

source

pub const ICMP_ERROR: Status = _

An ICMP error occurred during the network operation.

source

pub const TFTP_ERROR: Status = _

A TFTP error occurred during the network operation.

source

pub const PROTOCOL_ERROR: Status = _

A protocol error occurred during the network operation.

source

pub const INCOMPATIBLE_VERSION: Status = _

The function encountered an internal version that was incompatible with a version requested by the caller.

source

pub const SECURITY_VIOLATION: Status = _

The function was not performed due to a security violation.

source

pub const CRC_ERROR: Status = _

A CRC error was detected.

source

pub const END_OF_MEDIA: Status = _

Beginning or end of media was reached

source

pub const END_OF_FILE: Status = _

The end of the file was reached.

source

pub const INVALID_LANGUAGE: Status = _

The language specified was invalid.

source

pub const COMPROMISED_DATA: Status = _

The security status of the data is unknown or compromised and the data must be updated or replaced to restore a valid security status.

source

pub const IP_ADDRESS_CONFLICT: Status = _

There is an address conflict address allocation

source

pub const HTTP_ERROR: Status = _

A HTTP error occurred during the network operation.

source§

impl Status

source

pub fn is_success(self) -> bool

Returns true if status code indicates success.

source

pub fn is_warning(self) -> bool

Returns true if status code indicates a warning.

source

pub const fn is_error(self) -> bool

Returns true if the status code indicates an error.

source

pub fn into_with_val<T>(self, val: impl FnOnce() -> T) -> Result<T, ()>

Converts this status code into a uefi::Result with a given Ok value.

If the status does not indicate success, the status representing the specific error code is embedded into the Err variant of type uefi::Error.

source

pub fn into_with_err<ErrData: Debug>( self, err: impl FnOnce(Status) -> ErrData ) -> Result<(), ErrData>

Converts this status code into a uefi::Result with a given Err payload.

If the status does not indicate success, the status representing the specific error code is embedded into the Err variant of type uefi::Error.

source

pub fn into_with<T, ErrData: Debug>( self, val: impl FnOnce() -> T, err: impl FnOnce(Status) -> ErrData ) -> Result<T, ErrData>

Convert this status code into a result with a given Ok value and Err payload.

If the status does not indicate success, the status representing the specific error code is embedded into the Err variant of type uefi::Error.

Trait Implementations§

source§

impl Clone for Status

source§

fn clone(&self) -> Status

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Status

source§

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

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

impl Display for Status

source§

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

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

impl From<Status> for Error<()>

source§

fn from(status: Status) -> Self

Converts to this type from the input type.
source§

impl From<Status> for Result<(), ()>

source§

fn from(status: Status) -> Result<(), ()>

Converts to this type from the input type.
source§

impl PartialEq<Status> for Status

source§

fn eq(&self, other: &Status) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Copy for Status

source§

impl Eq for Status

source§

impl StructuralEq for Status

source§

impl StructuralPartialEq for Status

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

const: unstable · 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> Pointee for T

§

type Metadata = ()

The type for metadata in pointers and references to Self.
source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

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

source§

default fn to_string(&self) -> String

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

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

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

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

§

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

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.