pub trait SendSyncError:
Any
+ Error
+ Send
+ Sync
+ 'static {
// Required method
fn as_any(&self) -> &dyn Any;
}Expand description
Any error that satisfies this trait’s bounds can be used in a ErrorUnion
Required Methods§
Sourcefn as_any(&self) -> &dyn Any
fn as_any(&self) -> &dyn Any
Converts this SendSynError to Any.
Warning: Use carefully since Any is this type,
not the underlying type. e.g. For x: Box<dyn SendSyncError> with x.as_any(),
the type yielded is Box<dyn SendSyncError> so functions like x.is::<T>() will not work as expected.
While one would probably want (&*x as &dyn Any) which is the underlying and x.is::<T>()
will work as expected.
The main use case for this function is when x: &dyn SendSyncError.
In such case x.is::<T>() will likely work as intended.
Trait Implementations§
Source§impl Error for Box<dyn SendSyncError>
impl Error for Box<dyn SendSyncError>
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()
Source§impl From<Box<dyn SendSyncError>> for ContextValue
impl From<Box<dyn SendSyncError>> for ContextValue
Source§fn from(e: Box<dyn SendSyncError>) -> Self
fn from(e: Box<dyn SendSyncError>) -> Self
Converts to this type from the input type.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".