On this page
Function std::error::request_value
pub fn request_value<T, 'a>(err: &'a (impl Error + ?Sized)) -> Option<T>
where
T: 'static,
🔬This is a nightly-only experimental API. (
error_generic_member_access
#99301)
Request a value of type T
from the given impl Error
.
Examples
Get a string value from an error.
use std::error::Error;
use core::error::request_value;
fn get_string(err: &impl Error) -> String {
request_value::<String>(err).unwrap()
}
© 2010 The Rust Project Developers
Licensed under the Apache License, Version 2.0 or the MIT license, at your option.
https://doc.rust-lang.org/std/error/fn.request_value.html