pub struct OpaqueError(/* private fields */);
Expand description
A type-erased error type that can be used as a trait object.
Note this type is not intended to be used directly,
it is used by rama
to hide the concrete error type.
See the module level documentation for more information.
Implementations§
Source§impl OpaqueError
impl OpaqueError
Sourcepub fn from_std(error: impl Error + Send + Sync + 'static) -> Self
pub fn from_std(error: impl Error + Send + Sync + 'static) -> Self
create an OpaqueError
from an std error
Sourcepub fn from_display(msg: impl Display + Debug + Send + Sync + 'static) -> Self
pub fn from_display(msg: impl Display + Debug + Send + Sync + 'static) -> Self
create an OpaqueError
from a display object
Sourcepub fn from_boxed(inner: BoxError) -> Self
pub fn from_boxed(inner: BoxError) -> Self
create an OpaqueError
from a boxed error
Sourcepub fn is<T>(&self) -> boolwhere
T: Error + 'static,
pub fn is<T>(&self) -> boolwhere
T: Error + 'static,
Returns true if the underlying error is of type T
.
Sourcepub fn into_boxed(self) -> BoxError
pub fn into_boxed(self) -> BoxError
Consumes the OpaqueError
and returns it as a BoxError
.
Sourcepub fn downcast<T>(self) -> Result<T, Self>where
T: Error + 'static,
pub fn downcast<T>(self) -> Result<T, Self>where
T: Error + 'static,
Attempts to downcast the error to the concrete type T
.
Sourcepub fn downcast_ref<T>(&self) -> Option<&T>where
T: Error + 'static,
pub fn downcast_ref<T>(&self) -> Option<&T>where
T: Error + 'static,
Attempts to downcast the error to a shared reference
of the concrete type T
.
Sourcepub fn downcast_mut<T>(&mut self) -> Option<&mut T>where
T: Error + 'static,
pub fn downcast_mut<T>(&mut self) -> Option<&mut T>where
T: Error + 'static,
Attempts to downcast the error to the exclusive reference
of the concrete type T
.
Trait Implementations§
Source§impl Debug for OpaqueError
impl Debug for OpaqueError
Source§impl Display for OpaqueError
impl Display for OpaqueError
Source§impl Error for OpaqueError
impl Error for OpaqueError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + '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 Freeze for OpaqueError
impl !RefUnwindSafe for OpaqueError
impl Send for OpaqueError
impl Sync for OpaqueError
impl Unpin for OpaqueError
impl !UnwindSafe for OpaqueError
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
Source§impl<Error> ErrorExt for Error
impl<Error> ErrorExt for Error
Source§fn context<M>(self, context: M) -> OpaqueError
fn context<M>(self, context: M) -> OpaqueError
Wrap the error in a context. Read more
Source§fn with_context<C, F>(self, context: F) -> OpaqueError
fn with_context<C, F>(self, context: F) -> OpaqueError
Lazily wrap the error with a context. Read more
Source§fn into_opaque(self) -> OpaqueError
fn into_opaque(self) -> OpaqueError
Convert the error into an
OpaqueError
. Read more