UniKind

Trait UniKind 

Source
pub trait UniKind:
    Debug
    + Any
    + Send
    + Sync {
    // Provided methods
    fn value(&self) -> Cow<'static, str> { ... }
    fn context(&self) -> Option<Cow<'static, str>> { ... }
    fn code(&self) -> i32 { ... }
    fn type_name(&self) -> &'static str { ... }
}
Expand description

A trait that specifies a custom error kind. Any specified to facilitate downcasting.

Provided Methods§

Source

fn value(&self) -> Cow<'static, str>

The string value of the kind, if any. This is useful for programmatic evaluation when the type is boxed in the error chain and the type is not known. Defaults to "".

Source

fn context(&self) -> Option<Cow<'static, str>>

Returns additional context for this specific kind, if any. Defaults to None.

Source

fn code(&self) -> i32

Returns the code (typically for FFI) for this specific kind. Defaults to -1.

Source

fn type_name(&self) -> &'static str

Returns the concrete type name.

Implementations§

Source§

impl dyn UniKind

Source

pub fn downcast_ref<T: UniKind>(&self) -> Option<&T>

Attempts to downcast a UniKind to a specific concrete type.

Implementations on Foreign Types§

Source§

impl UniKind for ()

Implementors§