#[non_exhaustive]pub struct Error {
pub(crate) kind: NetdocErrorKind,
msg: Option<Cow<'static, str>>,
pos: Pos,
source: Option<NetdocErrorSource>,
}
Expand description
An error that occurred while parsing a directory object of some kind.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. }
syntax; cannot be matched against without a wildcard ..
; and struct update syntax will not work.kind: NetdocErrorKind
What kind of error occurred?
msg: Option<Cow<'static, str>>
Do we have more information about the error?>
pos: Pos
Where did the error occur?
source: Option<NetdocErrorSource>
Was this caused by another error?
Implementations§
Source§impl Error
impl Error
Sourcepub fn within(self, s: &str) -> Error
pub fn within(self, s: &str) -> Error
Return a new error based on this one, with any byte-based position mapped to some line within a string.
Sourcepub fn at_pos(self, p: Pos) -> Error
pub fn at_pos(self, p: Pos) -> Error
Return a new error based on this one, with the position (if any) replaced by ‘p’.
Sourcepub fn or_at_pos(self, p: Pos) -> Error
pub fn or_at_pos(self, p: Pos) -> Error
Return a new error based on this one, with the position (if replaced by ‘p’ if it had no position before.
Sourcepub(crate) fn with_msg<T>(self, message: T) -> Error
pub(crate) fn with_msg<T>(self, message: T) -> Error
Return a new error based on this one, with the message value set to a provided static string.
Sourcepub(crate) fn with_source<T>(self, source: T) -> Errorwhere
T: Into<NetdocErrorSource>,
pub(crate) fn with_source<T>(self, source: T) -> Errorwhere
T: Into<NetdocErrorSource>,
Return a new error based on this one, with the source-error value set to the provided error.
Sourcepub fn netdoc_error_kind(&self) -> NetdocErrorKind
pub fn netdoc_error_kind(&self) -> NetdocErrorKind
Return the NetdocErrorKind
of this error.
Trait Implementations§
Source§impl Error for Error
impl Error for Error
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0: use the Display impl or to_string()
Source§impl From<AddrParseError> for Error
impl From<AddrParseError> for Error
Source§fn from(source: AddrParseError) -> Error
fn from(source: AddrParseError) -> Error
Converts to this type from the input type.
Source§impl From<Error> for BuildError
impl From<Error> for BuildError
Source§impl From<ParseIntError> for Error
impl From<ParseIntError> for Error
Source§fn from(source: ParseIntError) -> Error
fn from(source: ParseIntError) -> Error
Converts to this type from the input type.
Source§impl From<PolicyError> for Error
impl From<PolicyError> for Error
Source§fn from(source: PolicyError) -> Error
fn from(source: PolicyError) -> Error
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for Error
impl !RefUnwindSafe for Error
impl Send for Error
impl Sync for Error
impl Unpin for Error
impl !UnwindSafe for Error
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Converts
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
, which can then be
downcast
into Box<dyn ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Converts
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
, which can then be further
downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Converts
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Converts
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.§impl<T> DowncastSend for T
impl<T> DowncastSend for T
§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<E> ErrorReport for Ewhere
E: Error + 'static,
impl<E> ErrorReport for Ewhere
E: Error + 'static,
Source§fn report(&self) -> Report<ReportHelper<'_>>
fn report(&self) -> Report<ReportHelper<'_>>
Return an object that displays the error and its causes
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more