Skip to content

Commit

Permalink
Merge pull request #66 from vitiral/into_error
Browse files Browse the repository at this point in the history
add GlobError::into_error so that errors can be easily converted
  • Loading branch information
Kimundi authored Feb 21, 2018
2 parents fc308b1 + 99d5f12 commit 172265e
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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)
}
Expand Down

0 comments on commit 172265e

Please sign in to comment.