#[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()
Source§impl From<MetricsError> for FromPathError
impl From<MetricsError> for FromPathError
Source§fn from(e: MetricsError) -> Self
fn from(e: MetricsError) -> Self
Auto Trait Implementations§
impl !RefUnwindSafe for FromPathError
impl !UnwindSafe for FromPathError
impl Freeze for FromPathError
impl Send for FromPathError
impl Sync for FromPathError
impl Unpin for FromPathError
impl UnsafeUnpin for FromPathError
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> ErrorExt for T
impl<T> ErrorExt for T
Source§fn raise_typed(self) -> Exn<Self>where
Self: Sized,
fn raise_typed(self) -> Exn<Self>where
Self: Sized,
Self even when it is already an Error.Source§fn and_raise_typed<T>(self, context: T) -> Exn<T>
fn and_raise_typed<T>(self, context: T) -> Exn<T>
Self::and_raise(), retaining the context’s type in an exception.Source§fn raise_erased(self) -> Exnwhere
Self: Sized,
fn raise_erased(self) -> Exnwhere
Self: Sized,
crate::Error values reuse their existing frame and caller location.