Struct getrandom::Error[][src]

pub struct Error(_);
Expand description

A small and no_std compatible error type

The Error::raw_os_error() will indicate if the error is from the OS, and if so, which error code the OS gave the application. If such an error is encountered, please consult with your system documentation.

Internally this type is a NonZeroU32, with certain values reserved for certain purposes, see Error::INTERNAL_START and Error::CUSTOM_START.

If this crate’s "std" Cargo feature is enabled, then:

Implementations

This target/platform is not supported by getrandom.

The platform-specific errno returned a non-positive value.

Call to iOS SecRandomCopyBytes failed.

Call to Windows RtlGenRandom failed.

RDRAND instruction failed due to a hardware issue.

RDRAND instruction unsupported on this target.

The browser does not have support for self.crypto.

The browser does not have support for crypto.getRandomValues.

On VxWorks, call to randSecure failed (random number generator is not yet initialized).

NodeJS does not have support for the crypto module.

NodeJS does not have support for crypto.randomFillSync.

Codes below this point represent OS Errors (i.e. positive i32 values). Codes at or above this point, but below Error::CUSTOM_START are reserved for use by the rand and getrandom crates.

Codes at or above this point can be used by users to define their own custom errors.

Extract the raw OS error code (if this error came from the OS)

This method is identical to std::io::Error::raw_os_error(), except that it works in no_std contexts. If this method returns None, the error value can still be formatted via the Display implementation.

Extract the bare error code.

This code can either come from the underlying OS, or be a custom error. Use Error::raw_os_error() to disambiguate.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Formats the value using the given formatter. Read more

The lower-level source of this error, if any. Read more

🔬 This is a nightly-only experimental API. (backtrace)

Returns a stack backtrace, if available, of where this error occurred. Read more

👎 Deprecated since 1.42.0:

use the Display impl or to_string()

👎 Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Performs the conversion.

Performs the conversion.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

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

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.