Line | Count | Source |
1 | | use std::borrow::Cow; |
2 | | use std::error; |
3 | | use std::fmt; |
4 | | use std::io::{self, Error}; |
5 | | |
6 | | #[derive(Debug)] |
7 | | pub struct TarError { |
8 | | desc: Cow<'static, str>, |
9 | | io: io::Error, |
10 | | } |
11 | | |
12 | | impl TarError { |
13 | 12.6k | pub fn new(desc: impl Into<Cow<'static, str>>, err: Error) -> TarError { |
14 | 12.6k | TarError { |
15 | 12.6k | desc: desc.into(), |
16 | 12.6k | io: err, |
17 | 12.6k | } |
18 | 12.6k | } <tar::error::TarError>::new::<alloc::string::String> Line | Count | Source | 13 | 12.6k | pub fn new(desc: impl Into<Cow<'static, str>>, err: Error) -> TarError { | 14 | 12.6k | TarError { | 15 | 12.6k | desc: desc.into(), | 16 | 12.6k | io: err, | 17 | 12.6k | } | 18 | 12.6k | } |
Unexecuted instantiation: <tar::error::TarError>::new::<&str> |
19 | | } |
20 | | |
21 | | impl error::Error for TarError { |
22 | 0 | fn description(&self) -> &str { |
23 | 0 | &self.desc |
24 | 0 | } |
25 | | |
26 | 0 | fn source(&self) -> Option<&(dyn error::Error + 'static)> { |
27 | 0 | Some(&self.io) |
28 | 0 | } |
29 | | } |
30 | | |
31 | | impl fmt::Display for TarError { |
32 | 0 | fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { |
33 | 0 | self.desc.fmt(f) |
34 | 0 | } |
35 | | } |
36 | | |
37 | | impl From<TarError> for Error { |
38 | 12.6k | fn from(t: TarError) -> Error { |
39 | 12.6k | Error::new(t.io.kind(), t) |
40 | 12.6k | } |
41 | | } |