Skip to main content

SendSyncError

Trait SendSyncError 

Source
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§

Source

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>

Source§

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

👎Deprecated since 1.42.0:

use the Display impl or to_string()

1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl From<Box<dyn SendSyncError>> for ContextValue

Source§

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".

Implementors§

Source§

impl<T> SendSyncError for T
where T: Error + Any + Send + Sync + 'static,