move FallibleCtxExt
to func::context
This commit is contained in:
parent
0a0d17c34d
commit
49cfeea849
@ -52,3 +52,20 @@ pub type FallibleMonad<'a, Ctx, E> = <<Ctx as FallibleCtx<'a>>::Fallible as Mona
|
||||
|
||||
/// Preferred [Wrap]ped [Result].
|
||||
pub type FallibleWrapped<'a, Ctx, A, E> = Wrap<'a, A, FallibleMonad<'a, Ctx, E>>;
|
||||
|
||||
/// Extention trait for simpler conversion between [`FunctorContext::T`] and [`FallibleCtx::Fallible`].
|
||||
///
|
||||
/// this is the preferred way to switch between [WrapC] and [FallibleWrapped].
|
||||
pub trait FallibleCtxExt<'a>: FallibleCtx<'a> {
|
||||
/// Convert a fallible wrapped into a wrapped result.
|
||||
fn unstuff<A: 'a, E: 'a>(wa: FallibleWrapped<'a, Self, A, E>) -> WrapC<'a, Result<A, E>, Self> {
|
||||
Self::Fallible::unstuff(wa)
|
||||
}
|
||||
|
||||
/// Convert a wrapped result into a fallible wrapped.
|
||||
fn stuff<A: 'a, E: 'a>(fa: WrapC<'a, Result<A, E>, Self>) -> FallibleWrapped<'a, Self, A, E> {
|
||||
Self::Fallible::stuff(fa)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, Ctx: FallibleCtx<'a>> FallibleCtxExt<'a> for Ctx {}
|
||||
|
@ -3,7 +3,6 @@
|
||||
pub mod atomic;
|
||||
pub mod cast;
|
||||
pub mod collections;
|
||||
pub mod fallible;
|
||||
pub mod inject;
|
||||
pub mod inlining;
|
||||
mod local_origin;
|
||||
|
@ -7,7 +7,6 @@ use crate::{
|
||||
},
|
||||
func::context::*,
|
||||
rcore::*,
|
||||
rstd::fallible::*,
|
||||
};
|
||||
|
||||
use super::*;
|
||||
|
@ -1,24 +0,0 @@
|
||||
//! Shorthands for using [`Context::Fallible`].
|
||||
|
||||
use fail::*;
|
||||
|
||||
use crate::func::context::*;
|
||||
|
||||
use super::*;
|
||||
|
||||
/// Extention trait for simpler conversion between [`FunctorContext::T`] and [`FallibleCtx::Fallible`].
|
||||
///
|
||||
/// this is the preferred way to switch between [WrapC] and [FallibleWrapped].
|
||||
pub trait FallibleCtxExt<'a>: FallibleCtx<'a> {
|
||||
/// Convert a fallible wrapped into a wrapped result.
|
||||
fn unstuff<A: 'a, E: 'a>(wa: FallibleWrapped<'a, Self, A, E>) -> WrapC<'a, Result<A, E>, Self> {
|
||||
Self::Fallible::unstuff(wa)
|
||||
}
|
||||
|
||||
/// Convert a wrapped result into a fallible wrapped.
|
||||
fn stuff<A: 'a, E: 'a>(fa: WrapC<'a, Result<A, E>, Self>) -> FallibleWrapped<'a, Self, A, E> {
|
||||
Self::Fallible::stuff(fa)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, Ctx: FallibleCtx<'a>> FallibleCtxExt<'a> for Ctx {}
|
Loading…
Reference in New Issue
Block a user