| 1 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/; |
| 2 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/; |
| 3 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::errorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std error/::Errorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core error/Error# as StdErrorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core error/Error#; |
| 4 | |
| 5 | use {OSErrorrust-analyzer cargo libmount 0.1.15 OSError#, Errorrust-analyzer cargo libmount 0.1.15 Error#, MountErrorrust-analyzer cargo libmount 0.1.15 MountError#}; |
| 6 | use remount::RemountError; |
| 7 | |
| 8 | impl OSErrorrust-analyzer cargo libmount 0.1.15 OSError# { |
| 9 | /// Convert error to the one providing extra useful information |
| 10 | pub fn explainrust-analyzer cargo libmount 0.1.15 error/impl#[OSError]explain().(self) -> Errorrust-analyzer cargo libmount 0.1.15 Error# { |
| 11 | let text = self.1rust-analyzer cargo libmount 0.1.15 OSError#1..explainrust-analyzer cargo libmount 0.1.15 explain/Explainable#explain().(); |
| 12 | match self.0rust-analyzer cargo libmount 0.1.15 OSError#0. { |
| 13 | MountErrorrust-analyzer cargo libmount 0.1.15 MountError#::Iorust-analyzer cargo libmount 0.1.15 MountError#Io#(e) => Errorrust-analyzer cargo libmount 0.1.15 Error#(self.1rust-analyzer cargo libmount 0.1.15 OSError#1., e, text), |
| 14 | MountErrorrust-analyzer cargo libmount 0.1.15 MountError#::Remountrust-analyzer cargo libmount 0.1.15 MountError#Remount#(RemountErrorrust-analyzer cargo libmount 0.1.15 remount/RemountError#::Iorust-analyzer cargo libmount 0.1.15 remount/RemountError#Io#(msg, io_err)) => { |
| 15 | Errorrust-analyzer cargo libmount 0.1.15 Error#(self.1rust-analyzer cargo libmount 0.1.15 OSError#1., io_err, formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("{}, {}", msg, text)) |
| 16 | }, |
| 17 | MountErrorrust-analyzer cargo libmount 0.1.15 MountError#::Remountrust-analyzer cargo libmount 0.1.15 MountError#Remount#(err) => { |
| 18 | let text = formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("{}, {}", &err, text); |
| 19 | let err = Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/impl#[`Box<T>`]new().(err); |
| 20 | Errorrust-analyzer cargo libmount 0.1.15 Error#(self.1rust-analyzer cargo libmount 0.1.15 OSError#1., |
| 21 | iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Errorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Error#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/impl#[Error]new().(iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::ErrorKindrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/ErrorKind#::InvalidDatarust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/ErrorKind#InvalidData#, err), |
| 22 | text) |
| 23 | }, |
| 24 | } |
| 25 | } |
| 26 | } |
| 27 | |
| 28 | impl fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display# for OSErrorrust-analyzer cargo libmount 0.1.15 OSError# { |
| 29 | fn fmtrust-analyzer cargo libmount 0.1.15 error/impl#[OSError][Display]fmt().(&self, fmt: &mut fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Formatterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Formatter#) -> fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Result# { |
| 30 | writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(fmt, "{}: {}", self.1rust-analyzer cargo libmount 0.1.15 OSError#1., self.0rust-analyzer cargo libmount 0.1.15 OSError#0.) |
| 31 | } |
| 32 | } |
| 33 | |
| 34 | impl StdErrorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core error/Error# for OSErrorrust-analyzer cargo libmount 0.1.15 OSError# { |
| 35 | fn causerust-analyzer cargo libmount 0.1.15 error/impl#[OSError][Error]cause().(&self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<&StdErrorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core error/Error#> { |
| 36 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(&self.0rust-analyzer cargo libmount 0.1.15 OSError#0.) |
| 37 | } |
| 38 | fn descriptionrust-analyzer cargo libmount 0.1.15 error/impl#[OSError][Error]description().(&self) -> &str { |
| 39 | self.0rust-analyzer cargo libmount 0.1.15 OSError#0..descriptionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core error/Error#description().() |
| 40 | } |
| 41 | } |
| 42 | |
| 43 | impl fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display# for Errorrust-analyzer cargo libmount 0.1.15 Error# { |
| 44 | fn fmtrust-analyzer cargo libmount 0.1.15 error/impl#[Error][Display]fmt().(&self, fmt: &mut fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Formatterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Formatter#) -> fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Result# { |
| 45 | writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(fmt, "{}: {} ({})", self.0rust-analyzer cargo libmount 0.1.15 Error#0., self.1rust-analyzer cargo libmount 0.1.15 Error#1., self.2rust-analyzer cargo libmount 0.1.15 Error#2.) |
| 46 | } |
| 47 | } |
| 48 | |
| 49 | impl StdErrorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core error/Error# for Errorrust-analyzer cargo libmount 0.1.15 Error# { |
| 50 | fn causerust-analyzer cargo libmount 0.1.15 error/impl#[Error][Error]cause().(&self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<&StdErrorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core error/Error#> { |
| 51 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(&self.1rust-analyzer cargo libmount 0.1.15 Error#1.) |
| 52 | } |
| 53 | fn descriptionrust-analyzer cargo libmount 0.1.15 error/impl#[Error][Error]description().(&self) -> &str { |
| 54 | self.1rust-analyzer cargo libmount 0.1.15 Error#1..descriptionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core error/Error#description().() |
| 55 | } |
| 56 | } |