pub struct Report<T> { /* private fields */ }Expand description
Error report that wraps a typed context with an optional source chain.
Implementations§
Source§impl<T: StdError + Send + Sync + 'static> Report<T>
impl<T: StdError + Send + Sync + 'static> Report<T>
Sourcepub fn current_context(&self) -> &T
pub fn current_context(&self) -> &T
The typed context stored in this report.
Sourcepub fn change_context<U: StdError + Send + Sync + 'static>(
self,
new_context: U,
) -> Report<U>
pub fn change_context<U: StdError + Send + Sync + 'static>( self, new_context: U, ) -> Report<U>
Wrap this report as the source of a new context.
Sourcepub fn attach(self, key: impl Into<String>, value: impl Display) -> Self
pub fn attach(self, key: impl Into<String>, value: impl Display) -> Self
Add a key-value pair of additional context.
Sourcepub fn attach_path(self, value: impl AsRef<Path>) -> Self
pub fn attach_path(self, value: impl AsRef<Path>) -> Self
Add a path as additional context under the key "path".
Trait Implementations§
Source§impl<T: StdError + Send + Sync + 'static> Diagnostic for Report<T>
impl<T: StdError + Send + Sync + 'static> Diagnostic for Report<T>
Source§fn code<'a>(&'a self) -> Option<Box<dyn Display + 'a>>
fn code<'a>(&'a self) -> Option<Box<dyn Display + 'a>>
Unique diagnostic code that can be used to look up more information
about this
Diagnostic. Ideally also globally unique, and documented
in the toplevel crate’s documentation for easy searching. Rust path
format (foo::bar::baz) is recommended, but more classic codes like
E0123 or enums will work just fine.Source§fn severity(&self) -> Option<Severity>
fn severity(&self) -> Option<Severity>
Diagnostic severity. This may be used by
ReportHandlers to change the display format
of this diagnostic. Read moreSource§fn help<'a>(&'a self) -> Option<Box<dyn Display + 'a>>
fn help<'a>(&'a self) -> Option<Box<dyn Display + 'a>>
Additional help text related to this
Diagnostic. Do you have any
advice for the poor soul who’s just run into this issue?Source§fn url<'a>(&'a self) -> Option<Box<dyn Display + 'a>>
fn url<'a>(&'a self) -> Option<Box<dyn Display + 'a>>
URL to visit for a more detailed explanation/help about this
Diagnostic.Source§fn source_code(&self) -> Option<&dyn SourceCode>
fn source_code(&self) -> Option<&dyn SourceCode>
Source code to apply this
Diagnostic’s Diagnostic::labels to.Source§fn labels(&self) -> Option<Box<dyn Iterator<Item = LabeledSpan> + '_>>
fn labels(&self) -> Option<Box<dyn Iterator<Item = LabeledSpan> + '_>>
Labels to apply to this
Diagnostic’s Diagnostic::source_codeAdditional related
Diagnostics.Source§fn diagnostic_source(&self) -> Option<&dyn Diagnostic>
fn diagnostic_source(&self) -> Option<&dyn Diagnostic>
The cause of the error.
Source§impl<T: StdError + Send + Sync + 'static> Error for Report<T>
impl<T: StdError + Send + Sync + 'static> Error for Report<T>
Source§fn source(&self) -> Option<&(dyn StdError + 'static)>
fn source(&self) -> Option<&(dyn StdError + '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()
Auto Trait Implementations§
impl<T> Freeze for Report<T>where
T: Freeze,
impl<T> !RefUnwindSafe for Report<T>
impl<T> Send for Report<T>where
T: Send,
impl<T> Sync for Report<T>where
T: Sync,
impl<T> Unpin for Report<T>where
T: Unpin,
impl<T> UnsafeUnpin for Report<T>where
T: UnsafeUnpin,
impl<T> !UnwindSafe for Report<T>
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
Mutably borrows from an owned value. Read more