Trait zellij_utils::errors::ToAnyhow

source ·
pub trait ToAnyhow<U> {
    // Required method
    fn to_anyhow(self) -> Result<U>;
}
Expand description

Helper trait to convert error types that don’t satisfy anyhows trait requirements to anyhow errors.

Required Methods§

source

fn to_anyhow(self) -> Result<U>

Implementations on Foreign Types§

source§

impl<T: Debug, U> ToAnyhow<U> for Result<U, SendError<(T, ErrorContext)>>

SendError doesn’t satisfy anyhows trait requirements due to T possibly being a PluginInstruction type, which wraps an mpsc::Send and isn’t Sync. Due to this, in turn, the whole error type isn’t Sync and doesn’t work with anyhow (or pretty much any other error handling crate).

Takes the SendError and creates an anyhow error type with the message that was sent (formatted as string), attaching the ErrorContext as anyhow context to it.

source§

fn to_anyhow(self) -> Result<U>

source§

impl<U> ToAnyhow<U> for Result<U, PoisonError<U>>

source§

fn to_anyhow(self) -> Result<U>

Implementors§