xref: /third_party/rust/crates/which-rs/src/error.rs
  • Home
  • History
  • Annotate Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
  • only in /third_party/rust/crates/which-rs/src/
1b3ba51a1Sopenharmony_ciuse std::fmt;
2b3ba51a1Sopenharmony_ci
3b3ba51a1Sopenharmony_cipub type Result<T> = std::result::Result<T, Error>;
4b3ba51a1Sopenharmony_ci
5b3ba51a1Sopenharmony_ci#[derive(Copy, Clone, Eq, PartialEq, Debug)]
6b3ba51a1Sopenharmony_cipub enum Error {
7b3ba51a1Sopenharmony_ci    BadAbsolutePath,
8b3ba51a1Sopenharmony_ci    BadRelativePath,
9b3ba51a1Sopenharmony_ci    CannotFindBinaryPath,
10b3ba51a1Sopenharmony_ci    CannotGetCurrentDir,
11b3ba51a1Sopenharmony_ci    CannotCanonicalize,
12b3ba51a1Sopenharmony_ci}
13b3ba51a1Sopenharmony_ci
14b3ba51a1Sopenharmony_ciimpl std::error::Error for Error {}
15b3ba51a1Sopenharmony_ci
16b3ba51a1Sopenharmony_ciimpl fmt::Display for Error {
17b3ba51a1Sopenharmony_ci    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
18b3ba51a1Sopenharmony_ci        match self {
19b3ba51a1Sopenharmony_ci            Error::BadAbsolutePath => write!(f, "bad absolute path"),
20b3ba51a1Sopenharmony_ci            Error::BadRelativePath => write!(f, "bad relative path"),
21b3ba51a1Sopenharmony_ci            Error::CannotFindBinaryPath => write!(f, "cannot find binary path"),
22b3ba51a1Sopenharmony_ci            Error::CannotGetCurrentDir => write!(f, "cannot get current directory"),
23b3ba51a1Sopenharmony_ci            Error::CannotCanonicalize => write!(f, "cannot canonicalize path"),
24b3ba51a1Sopenharmony_ci        }
25b3ba51a1Sopenharmony_ci    }
26b3ba51a1Sopenharmony_ci}
27

Indexes created Thu Nov 07 10:32:03 CST 2024