pub struct ErrorChain<'a>(pub &'a (dyn Error + 'static));Expand description
Renders an error followed by every cause in its
source chain, outer: cause: root.
An error type’s own message names what failed and leaves the cause to
std::error::Error::source; this is where a reader that wants the whole
story (an MCP client, a log line) joins them once. No cause is skipped, so
a type must not also print its source in its own message.
§Examples
use std::path::PathBuf;
use mcpls_core::error::{Error, ErrorChain};
let error = Error::FileIo {
path: PathBuf::from("a.rs"),
source: std::io::Error::new(std::io::ErrorKind::NotFound, "gone"),
};
assert_eq!(ErrorChain(&error).to_string(), "file I/O error for \"a.rs\": gone");Tuple Fields§
§0: &'a (dyn Error + 'static)Trait Implementations§
Source§impl<'a> Clone for ErrorChain<'a>
impl<'a> Clone for ErrorChain<'a>
impl<'a> Copy for ErrorChain<'a>
Source§impl<'a> Debug for ErrorChain<'a>
impl<'a> Debug for ErrorChain<'a>
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for ErrorChain<'a>
impl<'a> !Send for ErrorChain<'a>
impl<'a> !Sync for ErrorChain<'a>
impl<'a> !UnwindSafe for ErrorChain<'a>
impl<'a> Freeze for ErrorChain<'a>
impl<'a> Unpin for ErrorChain<'a>
impl<'a> UnsafeUnpin for ErrorChain<'a>
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