pub trait Causes {
Show 15 methods
// Required methods
fn problem(&self) -> &Problem;
fn iter_causes(&self) -> impl Iterator<Item = &Cause>;
// Provided methods
fn iter_causes_with_error_type<ErrorT>(
&self,
) -> impl Iterator<Item = CauseRef<'_, ErrorT>>
where ErrorT: 'static + Error { ... }
fn iter_causes_until_error_type<ErrorT>(
&self,
) -> impl Iterator<Item = &Cause>
where ErrorT: 'static + Error { ... }
fn iter_causes_from_error_type<ErrorT>(
&self,
) -> impl Iterator<Item = &Cause>
where ErrorT: 'static + Error { ... }
fn iter_causes_with_error<ErrorT>(
&self,
error: &ErrorT,
) -> impl Iterator<Item = CauseRef<'_, ErrorT>>
where ErrorT: 'static + Error + PartialEq { ... }
fn iter_causes_with_attachment_type<AttachmentT>(
&self,
) -> impl Iterator<Item = (&Cause, &AttachmentT)>
where AttachmentT: 'static { ... }
fn cause_with_error_type<ErrorT>(&self) -> Option<CauseRef<'_, ErrorT>>
where ErrorT: 'static + Error { ... }
fn cause_with_error<ErrorT>(
&self,
error: &ErrorT,
) -> Option<CauseRef<'_, ErrorT>>
where ErrorT: 'static + Error + PartialEq { ... }
fn cause_with_attachment_type<AttachmentT>(
&self,
) -> Option<(&Cause, &AttachmentT)>
where AttachmentT: 'static { ... }
fn iter_errors(&self) -> impl Iterator<Item = &CapturedError> { ... }
fn iter_errors_of_type<ErrorT>(&self) -> impl Iterator<Item = &ErrorT>
where ErrorT: 'static + Error { ... }
fn error_of_type<ErrorT>(&self) -> Option<&ErrorT>
where ErrorT: 'static + Error { ... }
fn has_error_type<ErrorT>(&self) -> bool
where ErrorT: 'static + Error { ... }
fn has_error<ErrorT>(&self, error: &ErrorT) -> bool
where ErrorT: 'static + Error + PartialEq { ... }
}Expand description
Access to causes.
Required Methods§
Sourcefn iter_causes(&self) -> impl Iterator<Item = &Cause>
fn iter_causes(&self) -> impl Iterator<Item = &Cause>
Iterate causes in order of causation.
You can call iter_sources on each to further iterate the “branches” of the tree:
for cause in problem.iter_causes() {
for error in error.iter_sources() {
println!("{}", error);
}
}Provided Methods§
Sourcefn iter_causes_with_error_type<ErrorT>(
&self,
) -> impl Iterator<Item = CauseRef<'_, ErrorT>>where
ErrorT: 'static + Error,
fn iter_causes_with_error_type<ErrorT>(
&self,
) -> impl Iterator<Item = CauseRef<'_, ErrorT>>where
ErrorT: 'static + Error,
Iterate causes with an error of a type.
Will recurse into source.
Sourcefn iter_causes_until_error_type<ErrorT>(&self) -> impl Iterator<Item = &Cause>where
ErrorT: 'static + Error,
fn iter_causes_until_error_type<ErrorT>(&self) -> impl Iterator<Item = &Cause>where
ErrorT: 'static + Error,
Iterate causes in order of causation until (but not including) a cause with an error of a type.
Will recurse into source.
Sourcefn iter_causes_from_error_type<ErrorT>(&self) -> impl Iterator<Item = &Cause>where
ErrorT: 'static + Error,
fn iter_causes_from_error_type<ErrorT>(&self) -> impl Iterator<Item = &Cause>where
ErrorT: 'static + Error,
Iterate causes in order of causation from a cause with an error of a type.
Will recurse into source.
Sourcefn iter_causes_with_error<ErrorT>(
&self,
error: &ErrorT,
) -> impl Iterator<Item = CauseRef<'_, ErrorT>>
fn iter_causes_with_error<ErrorT>( &self, error: &ErrorT, ) -> impl Iterator<Item = CauseRef<'_, ErrorT>>
Iterate causes with the error.
Will recurse into source.
Sourcefn iter_causes_with_attachment_type<AttachmentT>(
&self,
) -> impl Iterator<Item = (&Cause, &AttachmentT)>where
AttachmentT: 'static,
fn iter_causes_with_attachment_type<AttachmentT>(
&self,
) -> impl Iterator<Item = (&Cause, &AttachmentT)>where
AttachmentT: 'static,
Iterate causes with an attachment of a type.
Sourcefn cause_with_error_type<ErrorT>(&self) -> Option<CauseRef<'_, ErrorT>>where
ErrorT: 'static + Error,
fn cause_with_error_type<ErrorT>(&self) -> Option<CauseRef<'_, ErrorT>>where
ErrorT: 'static + Error,
The first cause with an error of a type.
Will recurse into source.
Sourcefn cause_with_error<ErrorT>(
&self,
error: &ErrorT,
) -> Option<CauseRef<'_, ErrorT>>
fn cause_with_error<ErrorT>( &self, error: &ErrorT, ) -> Option<CauseRef<'_, ErrorT>>
The first cause with the error.
Will recurse into source.
Sourcefn cause_with_attachment_type<AttachmentT>(
&self,
) -> Option<(&Cause, &AttachmentT)>where
AttachmentT: 'static,
fn cause_with_attachment_type<AttachmentT>(
&self,
) -> Option<(&Cause, &AttachmentT)>where
AttachmentT: 'static,
The first cause with an attachment of a type.
Sourcefn iter_errors(&self) -> impl Iterator<Item = &CapturedError>
fn iter_errors(&self) -> impl Iterator<Item = &CapturedError>
Iterate errors in order of causation.
Note that this will not include source, however you can call iter_sources on each to further iterate the “branches” of the tree:
for error in problem.iter_errors() {
for error in error.as_ref().iter_sources() {
println!("{}", error);
}
}Sourcefn iter_errors_of_type<ErrorT>(&self) -> impl Iterator<Item = &ErrorT>where
ErrorT: 'static + Error,
fn iter_errors_of_type<ErrorT>(&self) -> impl Iterator<Item = &ErrorT>where
ErrorT: 'static + Error,
Iterate errors of a type in order of causation.
Note that this will not include source.
Sourcefn error_of_type<ErrorT>(&self) -> Option<&ErrorT>where
ErrorT: 'static + Error,
fn error_of_type<ErrorT>(&self) -> Option<&ErrorT>where
ErrorT: 'static + Error,
The first error of a type.
Note that this will not include source.
Sourcefn has_error_type<ErrorT>(&self) -> boolwhere
ErrorT: 'static + Error,
fn has_error_type<ErrorT>(&self) -> boolwhere
ErrorT: 'static + Error,
Whether we have an error of a type in the causation chain.
Will recurse into source.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.