//! Shorthands for using [`Context::Fallible`]. use fail::*; use crate::func::context::*; use super::*; /// Extention trait for simpler conversion between [`FunctorContext::T`] and [`Context::Fallible`]. /// /// Until either Rust type system or [`crate::func`] take serious changes, /// this is the preferred way to switch between [Wrapped] and [fallible]. pub trait FallibleContext<'a>: FallibleCtx<'a> { /// Convert a fallible wrapped into a wrapped result. fn unstuff(wa: FallibleWrapped<'a, Self, A, E>) -> WrapC<'a, Result, Self> { Self::Fallible::unstuff(wa) } /// Convert a wrapped result into a fallible wrapped. fn stuff(fa: WrapC<'a, Result, Self>) -> FallibleWrapped<'a, Self, A, E> { Self::Fallible::stuff(fa) } } impl<'a, Ctx: FallibleCtx<'a>> FallibleContext<'a> for Ctx {}