#[non_exhaustive]pub enum FromPathError {
Io(Error),
NonUtf8Path,
Unreadable,
UnknownLanguage,
Parse(MetricsError),
}Expand description
Error returned by Ast::from_path.
from_path reads, language-detects, and parses a file in one call, so it
can fail in more ways than the in-memory Ast::parse
(which only reports MetricsError). Unlike analyze,
from_path does not silently skip files: every reason it cannot produce a
tree surfaces as a distinct variant so the caller — who asked for this
file’s tree — learns why.
The enum is #[non_exhaustive]; match with a trailing _ arm to stay
forward-compatible.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Io(Error)
The file could not be read (a genuine I/O fault: missing file,
permission denied, hardware error). Carries the underlying
std::io::Error.
NonUtf8Path
The path is not valid UTF-8. The path doubles as the resulting
FuncSpace name (an identifier used as a map key
and in JSON output), so a lossy conversion is rejected rather than
silently corrupting correlation — mirroring analyze’s strict
default.
Unreadable
The file is empty, too small, binary, or encoded in an unsupported
encoding (UTF-16, invalid UTF-8) — the same files
analyze skips. from_path reuses the library’s
text reader for byte-exact metric parity with analyze, so these
inputs cannot yield a tree.
UnknownLanguage
No language is registered for the path (unknown extension and no recognizable shebang / mode line).
Parse(MetricsError)
The detected language’s per-language Cargo feature is not enabled in
this build (carries the MetricsError::LanguageDisabled raised by
Ast::parse).
Trait Implementations§
Source§impl Debug for FromPathError
impl Debug for FromPathError
Source§impl Display for FromPathError
impl Display for FromPathError
Source§impl Error for FromPathError
impl Error for FromPathError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()