From 99d5f120652c4f93af2988968d93f795ddf0c4c1 Mon Sep 17 00:00:00 2001 From: Garrett Berg Date: Mon, 29 Jan 2018 10:58:16 -0700 Subject: [PATCH] add GlobError::into_error so that errors can be easily converted --- src/lib.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index b5a31e6..9b795da 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -61,6 +61,7 @@ #![deny(missing_docs)] #![cfg_attr(all(test, windows), feature(std_misc))] +#[allow(unused_imports)] use std::ascii::AsciiExt; use std::cmp; use std::fmt; @@ -279,12 +280,18 @@ impl GlobError { pub fn error(&self) -> &io::Error { &self.error } + + /// Consumes self, returning the _raw_ underlying `io::Error` + pub fn into_error(self) -> io::Error { + self.error + } } impl Error for GlobError { fn description(&self) -> &str { self.error.description() } + fn cause(&self) -> Option<&Error> { Some(&self.error) }