standard_lib/fs/path/
error.rs

1use derive_more::{Display, Error, From};
2
3use crate::fs::error::{EmptyStrError, ExcessiveLinksError, HomeResolutionError, MissingComponentError, NoSearchError, NonDirComponentError, PathLengthError};
4use crate::fs::file::MetadataError;
5
6#[derive(#[automatically_derived]
impl ::core::fmt::Debug for PathError {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        match self {
            PathError::NoSearch(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f,
                    "NoSearch", &__self_0),
            PathError::ExcessiveLinks(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f,
                    "ExcessiveLinks", &__self_0),
            PathError::PathLength(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f,
                    "PathLength", &__self_0),
            PathError::MissingComponent(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f,
                    "MissingComponent", &__self_0),
            PathError::NonDirComponent(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f,
                    "NonDirComponent", &__self_0),
        }
    }
}Debug, #[allow(deprecated)]
#[allow(unreachable_code)]
#[automatically_derived]
impl derive_more::core::fmt::Display for PathError {
    fn fmt(&self, __derive_more_f: &mut derive_more::core::fmt::Formatter<'_>)
        -> derive_more::core::fmt::Result {
        match self {
            Self::NoSearch(_0) => {
                derive_more::core::fmt::Display::fmt(_0, __derive_more_f)
            }
            Self::ExcessiveLinks(_0) => {
                derive_more::core::fmt::Display::fmt(_0, __derive_more_f)
            }
            Self::PathLength(_0) => {
                derive_more::core::fmt::Display::fmt(_0, __derive_more_f)
            }
            Self::MissingComponent(_0) => {
                derive_more::core::fmt::Display::fmt(_0, __derive_more_f)
            }
            Self::NonDirComponent(_0) => {
                derive_more::core::fmt::Display::fmt(_0, __derive_more_f)
            }
        }
    }
}Display, #[automatically_derived]
impl ::core::clone::Clone for PathError {
    #[inline]
    fn clone(&self) -> PathError {
        match self {
            PathError::NoSearch(__self_0) =>
                PathError::NoSearch(::core::clone::Clone::clone(__self_0)),
            PathError::ExcessiveLinks(__self_0) =>
                PathError::ExcessiveLinks(::core::clone::Clone::clone(__self_0)),
            PathError::PathLength(__self_0) =>
                PathError::PathLength(::core::clone::Clone::clone(__self_0)),
            PathError::MissingComponent(__self_0) =>
                PathError::MissingComponent(::core::clone::Clone::clone(__self_0)),
            PathError::NonDirComponent(__self_0) =>
                PathError::NonDirComponent(::core::clone::Clone::clone(__self_0)),
        }
    }
}Clone, #[allow(deprecated)]
#[allow(unreachable_code)]
#[automatically_derived]
impl derive_more::core::convert::From<(NonDirComponentError)> for PathError {
    #[inline]
    fn from(value: (NonDirComponentError)) -> Self {
        PathError::NonDirComponent(value)
    }
}From, #[automatically_derived]
impl derive_more::core::error::Error for PathError {
    fn source(&self)
        -> Option<&(dyn derive_more::core::error::Error + 'static)> {
        use derive_more::__private::AsDynError as _;
        match self {
            PathError::NoSearch(source) =>
                Some(source.__derive_more_as_dyn_error()),
            PathError::ExcessiveLinks(source) =>
                Some(source.__derive_more_as_dyn_error()),
            PathError::PathLength(source) =>
                Some(source.__derive_more_as_dyn_error()),
            PathError::MissingComponent(source) =>
                Some(source.__derive_more_as_dyn_error()),
            PathError::NonDirComponent(source) =>
                Some(source.__derive_more_as_dyn_error()),
        }
    }
}Error)]
7pub enum PathError {
8    NoSearch(NoSearchError),
9    ExcessiveLinks(ExcessiveLinksError),
10    PathLength(PathLengthError),
11    MissingComponent(MissingComponentError),
12    NonDirComponent(NonDirComponentError),
13}
14
15#[derive(#[automatically_derived]
impl ::core::fmt::Debug for PathOrMetadataError {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        match self {
            PathOrMetadataError::Path(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f, "Path",
                    &__self_0),
            PathOrMetadataError::Metadata(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f,
                    "Metadata", &__self_0),
        }
    }
}Debug, #[allow(deprecated)]
#[allow(unreachable_code)]
#[automatically_derived]
impl derive_more::core::fmt::Display for PathOrMetadataError {
    fn fmt(&self, __derive_more_f: &mut derive_more::core::fmt::Formatter<'_>)
        -> derive_more::core::fmt::Result {
        match self {
            Self::Path(_0) => {
                derive_more::core::fmt::Display::fmt(_0, __derive_more_f)
            }
            Self::Metadata(_0) => {
                derive_more::core::fmt::Display::fmt(_0, __derive_more_f)
            }
        }
    }
}Display, #[automatically_derived]
impl ::core::clone::Clone for PathOrMetadataError {
    #[inline]
    fn clone(&self) -> PathOrMetadataError {
        match self {
            PathOrMetadataError::Path(__self_0) =>
                PathOrMetadataError::Path(::core::clone::Clone::clone(__self_0)),
            PathOrMetadataError::Metadata(__self_0) =>
                PathOrMetadataError::Metadata(::core::clone::Clone::clone(__self_0)),
        }
    }
}Clone, #[allow(deprecated)]
#[allow(unreachable_code)]
#[automatically_derived]
impl derive_more::core::convert::From<(MetadataError)> for PathOrMetadataError
    {
    #[inline]
    fn from(value: (MetadataError)) -> Self {
        PathOrMetadataError::Metadata(value)
    }
}From, #[automatically_derived]
impl derive_more::core::error::Error for PathOrMetadataError {
    fn source(&self)
        -> Option<&(dyn derive_more::core::error::Error + 'static)> {
        use derive_more::__private::AsDynError as _;
        match self {
            PathOrMetadataError::Path(source) =>
                Some(source.__derive_more_as_dyn_error()),
            PathOrMetadataError::Metadata(source) =>
                Some(source.__derive_more_as_dyn_error()),
        }
    }
}Error)]
16// TODO: Maybe make this a union type?
17pub enum PathOrMetadataError {
18    Path(PathError),
19    Metadata(MetadataError),
20}
21
22
23#[derive(#[automatically_derived]
impl ::core::fmt::Debug for PathParseError {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        match self {
            PathParseError::EmptyStr(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f,
                    "EmptyStr", &__self_0),
            PathParseError::HomeResolution(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f,
                    "HomeResolution", &__self_0),
        }
    }
}Debug, #[allow(deprecated)]
#[allow(unreachable_code)]
#[automatically_derived]
impl derive_more::core::fmt::Display for PathParseError {
    fn fmt(&self, __derive_more_f: &mut derive_more::core::fmt::Formatter<'_>)
        -> derive_more::core::fmt::Result {
        match self {
            Self::EmptyStr(_0) => {
                derive_more::core::fmt::Display::fmt(_0, __derive_more_f)
            }
            Self::HomeResolution(_0) => {
                derive_more::core::fmt::Display::fmt(_0, __derive_more_f)
            }
        }
    }
}Display, #[automatically_derived]
impl ::core::clone::Clone for PathParseError {
    #[inline]
    fn clone(&self) -> PathParseError {
        match self {
            PathParseError::EmptyStr(__self_0) =>
                PathParseError::EmptyStr(::core::clone::Clone::clone(__self_0)),
            PathParseError::HomeResolution(__self_0) =>
                PathParseError::HomeResolution(::core::clone::Clone::clone(__self_0)),
        }
    }
}Clone, #[allow(deprecated)]
#[allow(unreachable_code)]
#[automatically_derived]
impl derive_more::core::convert::From<(HomeResolutionError)> for
    PathParseError {
    #[inline]
    fn from(value: (HomeResolutionError)) -> Self {
        PathParseError::HomeResolution(value)
    }
}From, #[automatically_derived]
impl derive_more::core::error::Error for PathParseError {
    fn source(&self)
        -> Option<&(dyn derive_more::core::error::Error + 'static)> {
        use derive_more::__private::AsDynError as _;
        match self {
            PathParseError::EmptyStr(source) =>
                Some(source.__derive_more_as_dyn_error()),
            PathParseError::HomeResolution(source) =>
                Some(source.__derive_more_as_dyn_error()),
        }
    }
}Error)]
24pub enum PathParseError {
25    EmptyStr(EmptyStrError),
26    HomeResolution(HomeResolutionError),
27}