Function wasmtime_environ::__core::error::request_value

source ·
pub fn request_value<'a, T>(err: &'a (impl Error + ?Sized)) -> Option<T>
where T: 'static,
🔬This is a nightly-only experimental API. (error_generic_member_access)
Expand description

Request a value of type T from the given impl Error.

§Examples

Get a string value from an error.

#![feature(error_generic_member_access)]
use std::error::Error;
use core::error::request_value;

fn get_string(err: &impl Error) -> String {
    request_value::<String>(err).unwrap()
}