I have a glob::GlobError
from the glob crate . There's an underlying io::Error
that I need. How do I get it? There's a few methods available, such as this one:
fn error(&self) -> &io::Error
However, it just returns a reference. I need to own it, since I want to put it into another error struct that requires ownership.
An other options is this:
fn cause(&self) -> Option<&std::error::Error>
Same problem with the reference, and on top it's the wrong error type.
It it possible to get an io::Error
somehow?
You're looking at outdated documentation.
Go to the latest version, there's a pub fn into_error(self) -> Error
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.