[−][src]Struct witcher::Error
Error
is a wrapper providing additional context and chaining of errors.
Error
provides the following benefits
- ensures a backtrace will be taken at the earliest opportunity
- ensures that the error type is threadsafe and has a static lifetime
- provides matching on inner error types
Context comes in two forms. First every time an error is wrapped you have the opportunity to add an additional message. Finally a simplified stack trace is automatically provided that narrows in on your actual code ignoring the wind up and wind down that resides in the Rust std libraries and other dependencies allowing you to focus on your code.
Saftey: data layout ensured to be consistent with repr(C) for raw conversions.
Implementations
impl Error
[src]
pub fn raw(msg: &str) -> Self
[src]
Create a new error instance wrapped in a result
pub fn wrapr<E>(err: E, msg: &str) -> Self where
E: StdError + Send + Sync + 'static,
[src]
E: StdError + Send + Sync + 'static,
Wrap the given error and include a contextual message for the error.
pub fn new<T>(msg: &str) -> Result<T>
[src]
Create a new error instance wrapped in a result
pub fn pass<T, E>(err: E) -> Result<T> where
E: StdError + Send + Sync + 'static,
[src]
E: StdError + Send + Sync + 'static,
Pass the given error through without a message
pub fn wrap<T, E>(err: E, msg: &str) -> Result<T> where
E: StdError + Send + Sync + 'static,
[src]
E: StdError + Send + Sync + 'static,
Wrap the given error and include a contextual message for the error.
pub fn ext(&self) -> &(dyn StdError + 'static)
[src]
Return the first external error of the error chain for downcasting.
The intent is that when writing application code there are cases where your more
interested in reacting to an external failure.
If there is no external error then you'll get the last Error
in the chain.
pub fn last(&self) -> &(dyn StdError + 'static)
[src]
Return the last of the error chain for downcasting. This will follow the chain of source errors down to the last and return it. If this error is the only error it will be returned instead.
pub fn is<T: StdError + 'static>(&self) -> bool
[src]
Implemented directly on the Error
type to reduce casting required
pub fn downcast_ref<T: StdError + 'static>(&self) -> Option<&T>
[src]
Implemented directly on the Error
type to reduce casting required
pub fn source(&self) -> Option<&(dyn StdError + 'static)>
[src]
Implemented directly on the Error
type to reduce casting required
Trait Implementations
impl AsRef<dyn Error + 'static> for Error
[src]
impl Debug for Error
[src]
Provides the same formatting for output as Display but includes the fullstack trace.
impl Display for Error
[src]
Provides formatting for output with frames filtered to just target code
impl Error for Error
[src]
Auto Trait Implementations
impl !RefUnwindSafe for Error
[src]
impl Send for Error
[src]
impl Sync for Error
[src]
impl Unpin for Error
[src]
impl !UnwindSafe for Error
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,