pub enum ErrorKind<E, B> {
Std {
source: E,
backtrace: B,
},
Err2 {
source: E,
},
}Expand description
Represents the kind of error after downcasting BoxedError2.
Used to distinguish between standard library errors and Error2 errors when downcasting type-erased errors.
§Variants
Std: Error fromstd::error::Error(has its own backtrace)Err2: Error implementingError2(reuses parent backtrace)
§Example
use std::io;
use error2::{kind::ErrorKind, prelude::*};
let err = std::io::Error::from(std::io::ErrorKind::NotFound);
let boxed = BoxedError2::from_std(err);
// Downcast to get the ErrorKind
match boxed.downcast_ref::<io::Error>() {
Some(ErrorKind::Std { source, backtrace }) => {
println!("Std error: {}", source);
}
Some(ErrorKind::Err2 { source }) => {
println!("Error2: {}", source);
}
None => {}
}Variants§
Std
Standard library error with its own backtrace.
Err2
Error2 error that reuses the parent’s backtrace.
Fields
§
source: EThe underlying Error2 instance.
Auto Trait Implementations§
impl<E, B> Freeze for ErrorKind<E, B>
impl<E, B> RefUnwindSafe for ErrorKind<E, B>where
E: RefUnwindSafe,
B: RefUnwindSafe,
impl<E, B> Send for ErrorKind<E, B>
impl<E, B> Sync for ErrorKind<E, B>
impl<E, B> Unpin for ErrorKind<E, B>
impl<E, B> UnwindSafe for ErrorKind<E, B>where
E: UnwindSafe,
B: UnwindSafe,
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