/rust/registry/src/index.crates.io-1949cf8c6b5b557f/xattr-1.6.1/src/error.rs
Line | Count | Source |
1 | | use std::error::Error; |
2 | | use std::fmt; |
3 | | |
4 | | /// The error type returned on unsupported platforms. |
5 | | /// |
6 | | /// On unsupported platforms, all operations will fail with an `io::Error` with |
7 | | /// a kind `io::ErrorKind::Unsupported` and an `UnsupportedPlatformError` error as the inner error. |
8 | | /// While you *could* check the inner error, it's probably simpler just to check |
9 | | /// `xattr::SUPPORTED_PLATFORM`. |
10 | | /// |
11 | | /// This error mostly exists for pretty error messages. |
12 | | #[derive(Copy, Clone, Debug)] |
13 | | pub struct UnsupportedPlatformError; |
14 | | |
15 | | impl Error for UnsupportedPlatformError { |
16 | 0 | fn description(&self) -> &str { |
17 | 0 | "unsupported platform" |
18 | 0 | } |
19 | | } |
20 | | |
21 | | impl fmt::Display for UnsupportedPlatformError { |
22 | 0 | fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { |
23 | 0 | write!( |
24 | 0 | f, |
25 | 0 | "unsupported platform, please file a bug at `https://github.com/Stebalien/xattr'" |
26 | | ) |
27 | 0 | } |
28 | | } |