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 anyhow
s trait requirements to
anyhow errors.
Required Methods§
Implementations on Foreign Types§
source§impl<T: Debug, U> ToAnyhow<U> for Result<U, SendError<(T, ErrorContext)>>
impl<T: Debug, U> ToAnyhow<U> for Result<U, SendError<(T, ErrorContext)>>
SendError
doesn’t satisfy anyhow
s 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.