pub struct ControlFlowContinueAppliedBrand<C>(/* private fields */);Expand description
Brand for the partially-applied form of ControlFlow with the Continue type applied.
Fixes the Continue (continuation) type, yielding a Functor over the Break
(result) type.
Trait Implementations§
Source§impl<ContinueType: Clone + 'static> ApplyFirst for ControlFlowContinueAppliedBrand<ContinueType>
§Type Parameters
ContinueType: The continue type.
impl<ContinueType: Clone + 'static> ApplyFirst for ControlFlowContinueAppliedBrand<ContinueType>
§Type Parameters
ContinueType: The continue type.
Source§fn apply_first<'a, A: 'a + Clone, B: 'a + Clone>(
fa: <Self as Kind_cdc7cd43dac7585f>::Of<'a, A>,
fb: <Self as Kind_cdc7cd43dac7585f>::Of<'a, B>,
) -> <Self as Kind_cdc7cd43dac7585f>::Of<'a, A>
fn apply_first<'a, A: 'a + Clone, B: 'a + Clone>( fa: <Self as Kind_cdc7cd43dac7585f>::Of<'a, A>, fb: <Self as Kind_cdc7cd43dac7585f>::Of<'a, B>, ) -> <Self as Kind_cdc7cd43dac7585f>::Of<'a, A>
Source§impl<ContinueType: Clone + 'static> ApplySecond for ControlFlowContinueAppliedBrand<ContinueType>
§Type Parameters
ContinueType: The continue type.
impl<ContinueType: Clone + 'static> ApplySecond for ControlFlowContinueAppliedBrand<ContinueType>
§Type Parameters
ContinueType: The continue type.
Source§fn apply_second<'a, A: 'a + Clone, B: 'a + Clone>(
fa: <Self as Kind_cdc7cd43dac7585f>::Of<'a, A>,
fb: <Self as Kind_cdc7cd43dac7585f>::Of<'a, B>,
) -> <Self as Kind_cdc7cd43dac7585f>::Of<'a, B>
fn apply_second<'a, A: 'a + Clone, B: 'a + Clone>( fa: <Self as Kind_cdc7cd43dac7585f>::Of<'a, A>, fb: <Self as Kind_cdc7cd43dac7585f>::Of<'a, B>, ) -> <Self as Kind_cdc7cd43dac7585f>::Of<'a, B>
Source§impl<C: Clone> Clone for ControlFlowContinueAppliedBrand<C>
impl<C: Clone> Clone for ControlFlowContinueAppliedBrand<C>
Source§fn clone(&self) -> ControlFlowContinueAppliedBrand<C>
fn clone(&self) -> ControlFlowContinueAppliedBrand<C>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<C: Debug> Debug for ControlFlowContinueAppliedBrand<C>
impl<C: Debug> Debug for ControlFlowContinueAppliedBrand<C>
Source§impl<C: Default> Default for ControlFlowContinueAppliedBrand<C>
impl<C: Default> Default for ControlFlowContinueAppliedBrand<C>
Source§fn default() -> ControlFlowContinueAppliedBrand<C>
fn default() -> ControlFlowContinueAppliedBrand<C>
Source§impl<ContinueType: 'static> Foldable for ControlFlowContinueAppliedBrand<ContinueType>
§Type Parameters
ContinueType: The continue type.
impl<ContinueType: 'static> Foldable for ControlFlowContinueAppliedBrand<ContinueType>
§Type Parameters
ContinueType: The continue type.
Source§fn fold_right<'a, FnBrand, A: 'a, B: 'a>(
func: impl Fn(A, B) -> B + 'a,
initial: B,
fa: <Self as Kind_cdc7cd43dac7585f>::Of<'a, A>,
) -> Bwhere
FnBrand: CloneFn + 'a,
fn fold_right<'a, FnBrand, A: 'a, B: 'a>(
func: impl Fn(A, B) -> B + 'a,
initial: B,
fa: <Self as Kind_cdc7cd43dac7585f>::Of<'a, A>,
) -> Bwhere
FnBrand: CloneFn + 'a,
Folds the control flow from the right.
This method performs a right-associative fold of the control flow.
§Type Signature
forall ContinueType A B. CloneFn FnBrand => ((A, B) -> B, B, ControlFlowContinueApplied ContinueType A) -> B
§Type Parameters
'a: The lifetime of the values.FnBrand: The brand of the cloneable function to use.A: The type of the elements in the structure.B: The type of the accumulator.
§Parameters
func: The folding function.initial: The initial value.fa: The control flow to fold.
§Returns
func(a, initial) if fa is Break(a), otherwise initial.
§Examples
use {
core::ops::ControlFlow,
fp_library::{
brands::*,
functions::*,
},
};
assert_eq!(
explicit::fold_right::<RcFnBrand, ControlFlowContinueAppliedBrand<()>, _, _, _, _>(
|x, acc| x + acc,
0,
ControlFlow::Break(5)
),
5
);
assert_eq!(
explicit::fold_right::<RcFnBrand, ControlFlowContinueAppliedBrand<i32>, _, _, _, _>(
|x: i32, acc| x + acc,
0,
ControlFlow::Continue(1)
),
0
);Source§fn fold_left<'a, FnBrand, A: 'a, B: 'a>(
func: impl Fn(B, A) -> B + 'a,
initial: B,
fa: <Self as Kind_cdc7cd43dac7585f>::Of<'a, A>,
) -> Bwhere
FnBrand: CloneFn + 'a,
fn fold_left<'a, FnBrand, A: 'a, B: 'a>(
func: impl Fn(B, A) -> B + 'a,
initial: B,
fa: <Self as Kind_cdc7cd43dac7585f>::Of<'a, A>,
) -> Bwhere
FnBrand: CloneFn + 'a,
Folds the control flow from the left.
This method performs a left-associative fold of the control flow.
§Type Signature
forall ContinueType A B. CloneFn FnBrand => ((B, A) -> B, B, ControlFlowContinueApplied ContinueType A) -> B
§Type Parameters
'a: The lifetime of the values.FnBrand: The brand of the cloneable function to use.A: The type of the elements in the structure.B: The type of the accumulator.
§Parameters
func: The folding function.initial: The initial value.fa: The control flow to fold.
§Returns
func(initial, a) if fa is Break(a), otherwise initial.
§Examples
use {
core::ops::ControlFlow,
fp_library::{
brands::*,
functions::*,
},
};
assert_eq!(
explicit::fold_left::<RcFnBrand, ControlFlowContinueAppliedBrand<()>, _, _, _, _>(
|acc, x| acc + x,
0,
ControlFlow::Break(5)
),
5
);
assert_eq!(
explicit::fold_left::<RcFnBrand, ControlFlowContinueAppliedBrand<i32>, _, _, _, _>(
|acc, x: i32| acc + x,
0,
ControlFlow::Continue(1)
),
0
);Source§fn fold_map<'a, FnBrand, A: 'a, M>(
func: impl Fn(A) -> M + 'a,
fa: <Self as Kind_cdc7cd43dac7585f>::Of<'a, A>,
) -> M
fn fold_map<'a, FnBrand, A: 'a, M>( func: impl Fn(A) -> M + 'a, fa: <Self as Kind_cdc7cd43dac7585f>::Of<'a, A>, ) -> M
Maps the value to a monoid and returns it.
This method maps the element of the control flow to a monoid and then returns it.
§Type Signature
forall ContinueType A M. (Monoid M, CloneFn FnBrand) => (A -> M, ControlFlowContinueApplied ContinueType A) -> M
§Type Parameters
'a: The lifetime of the values.FnBrand: The brand of the cloneable function to use.A: The type of the elements in the structure.M: The type of the monoid.
§Parameters
func: The mapping function.fa: The control flow to fold.
§Returns
func(a) if fa is Break(a), otherwise M::empty().
§Examples
use {
core::ops::ControlFlow,
fp_library::{
brands::*,
functions::*,
},
};
assert_eq!(
explicit::fold_map::<RcFnBrand, ControlFlowContinueAppliedBrand<()>, _, _, _, _>(
|x: i32| x.to_string(),
ControlFlow::Break(5)
),
"5".to_string()
);
assert_eq!(
explicit::fold_map::<RcFnBrand, ControlFlowContinueAppliedBrand<i32>, _, _, _, _>(
|x: i32| x.to_string(),
ControlFlow::Continue(1)
),
"".to_string()
);Source§impl<ContinueType: 'static> Functor for ControlFlowContinueAppliedBrand<ContinueType>
§Type Parameters
ContinueType: The continue type.
impl<ContinueType: 'static> Functor for ControlFlowContinueAppliedBrand<ContinueType>
§Type Parameters
ContinueType: The continue type.
Source§fn map<'a, A: 'a, B: 'a>(
func: impl Fn(A) -> B + 'a,
fa: <Self as Kind_cdc7cd43dac7585f>::Of<'a, A>,
) -> <Self as Kind_cdc7cd43dac7585f>::Of<'a, B>
fn map<'a, A: 'a, B: 'a>( func: impl Fn(A) -> B + 'a, fa: <Self as Kind_cdc7cd43dac7585f>::Of<'a, A>, ) -> <Self as Kind_cdc7cd43dac7585f>::Of<'a, B>
Maps a function over the break value in the control flow.
This method applies a function to the break value inside the control flow, producing a new control flow with the transformed break value. The continue value remains unchanged.
§Type Signature
forall ContinueType A B. (A -> B, ControlFlowContinueApplied ContinueType A) -> ControlFlowContinueApplied ContinueType B
§Type Parameters
'a: The lifetime of the values.A: The type of the break value.B: The type of the result of applying the function.
§Parameters
func: The function to apply to the break value.fa: The control flow to map over.
§Returns
A new control flow containing the result of applying the function to the break value.
§Examples
use {
core::ops::ControlFlow,
fp_library::{
brands::*,
functions::*,
},
};
assert_eq!(
explicit::map::<ControlFlowContinueAppliedBrand<i32>, _, _, _, _>(
|x: i32| x * 2,
ControlFlow::<i32, i32>::Break(5)
),
ControlFlow::Break(10)
);Source§impl<C: Hash> Hash for ControlFlowContinueAppliedBrand<C>
impl<C: Hash> Hash for ControlFlowContinueAppliedBrand<C>
Source§impl<ContinueType: 'static> Kind_cdc7cd43dac7585f for ControlFlowContinueAppliedBrand<ContinueType>
Generated implementation of Kind_cdc7cd43dac7585f for ControlFlowContinueAppliedBrand < ContinueType >.
impl<ContinueType: 'static> Kind_cdc7cd43dac7585f for ControlFlowContinueAppliedBrand<ContinueType>
Generated implementation of Kind_cdc7cd43dac7585f for ControlFlowContinueAppliedBrand < ContinueType >.
Source§type Of<'a, B: 'a> = ControlFlow<B, ContinueType>
type Of<'a, B: 'a> = ControlFlow<B, ContinueType>
Source§impl<ContinueType: Clone + 'static> Lift for ControlFlowContinueAppliedBrand<ContinueType>
§Type Parameters
ContinueType: The continue type.
impl<ContinueType: Clone + 'static> Lift for ControlFlowContinueAppliedBrand<ContinueType>
§Type Parameters
ContinueType: The continue type.
Source§fn lift2<'a, A, B, C>(
func: impl Fn(A, B) -> C + 'a,
fa: <Self as Kind_cdc7cd43dac7585f>::Of<'a, A>,
fb: <Self as Kind_cdc7cd43dac7585f>::Of<'a, B>,
) -> <Self as Kind_cdc7cd43dac7585f>::Of<'a, C>
fn lift2<'a, A, B, C>( func: impl Fn(A, B) -> C + 'a, fa: <Self as Kind_cdc7cd43dac7585f>::Of<'a, A>, fb: <Self as Kind_cdc7cd43dac7585f>::Of<'a, B>, ) -> <Self as Kind_cdc7cd43dac7585f>::Of<'a, C>
Lifts a binary function into the control flow context.
This method lifts a binary function to operate on values within the control flow context.
§Type Signature
forall ContinueType A B C. ((A, B) -> C, ControlFlowContinueApplied ContinueType A, ControlFlowContinueApplied ContinueType B) -> ControlFlowContinueApplied ContinueType C
§Type Parameters
'a: The lifetime of the values.A: The type of the first value.B: The type of the second value.C: The type of the result.
§Parameters
func: The binary function to apply.fa: The first control flow.fb: The second control flow.
§Returns
Break(f(a, b)) if both are Break, otherwise the first continue encountered.
§Examples
use {
core::ops::ControlFlow,
fp_library::{
brands::*,
functions::*,
},
};
assert_eq!(
explicit::lift2::<ControlFlowContinueAppliedBrand<()>, _, _, _, _, _, _>(
|x: i32, y: i32| x + y,
ControlFlow::Break(1),
ControlFlow::Break(2)
),
ControlFlow::Break(3)
);
assert_eq!(
explicit::lift2::<ControlFlowContinueAppliedBrand<i32>, _, _, _, _, _, _>(
|x: i32, y: i32| x + y,
ControlFlow::Break(1),
ControlFlow::Continue(2)
),
ControlFlow::Continue(2)
);Source§impl<ContinueType: Clone + 'static> MonadRec for ControlFlowContinueAppliedBrand<ContinueType>
MonadRec implementation for ControlFlowContinueAppliedBrand.
impl<ContinueType: Clone + 'static> MonadRec for ControlFlowContinueAppliedBrand<ContinueType>
MonadRec implementation for ControlFlowContinueAppliedBrand.
§Type Parameters
ContinueType: The continue type.
Source§fn tail_rec_m<'a, A: 'a, B: 'a>(
func: impl Fn(A) -> <Self as Kind_cdc7cd43dac7585f>::Of<'a, ControlFlow<B, A>> + 'a,
initial: A,
) -> <Self as Kind_cdc7cd43dac7585f>::Of<'a, B>
fn tail_rec_m<'a, A: 'a, B: 'a>( func: impl Fn(A) -> <Self as Kind_cdc7cd43dac7585f>::Of<'a, ControlFlow<B, A>> + 'a, initial: A, ) -> <Self as Kind_cdc7cd43dac7585f>::Of<'a, B>
Performs tail-recursive monadic computation over ControlFlow (break channel).
Iteratively applies the step function. If the function returns ControlFlow::Continue,
the computation short-circuits with that continue value. If it returns
Break(ControlFlow::Continue(a)), the loop continues with the new state. If it returns
Break(ControlFlow::Break(b)), the computation completes with Break(b).
§Type Signature
forall ContinueType A B. (A -> ControlFlowContinueApplied ContinueType (ControlFlow B A), A) -> ControlFlowContinueApplied ContinueType B
§Type Parameters
'a: The lifetime of the computation.A: The type of the initial value and loop state.B: The type of the result.
§Parameters
func: The step function.initial: The initial value.
§Returns
The result of the computation, or a continue if the step function returned Continue.
§Examples
use {
core::ops::ControlFlow,
fp_library::{
brands::*,
functions::*,
},
};
let result = tail_rec_m::<ControlFlowContinueAppliedBrand<&str>, _, _>(
|n| {
if n < 10 {
ControlFlow::Break(ControlFlow::Continue(n + 1))
} else {
ControlFlow::Break(ControlFlow::Break(n))
}
},
0,
);
assert_eq!(result, ControlFlow::Break(10));Source§impl<C: Ord> Ord for ControlFlowContinueAppliedBrand<C>
impl<C: Ord> Ord for ControlFlowContinueAppliedBrand<C>
Source§fn cmp(&self, other: &ControlFlowContinueAppliedBrand<C>) -> Ordering
fn cmp(&self, other: &ControlFlowContinueAppliedBrand<C>) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl<C: PartialEq> PartialEq for ControlFlowContinueAppliedBrand<C>
impl<C: PartialEq> PartialEq for ControlFlowContinueAppliedBrand<C>
Source§fn eq(&self, other: &ControlFlowContinueAppliedBrand<C>) -> bool
fn eq(&self, other: &ControlFlowContinueAppliedBrand<C>) -> bool
self and other values to be equal, and is used by ==.Source§impl<C: PartialOrd> PartialOrd for ControlFlowContinueAppliedBrand<C>
impl<C: PartialOrd> PartialOrd for ControlFlowContinueAppliedBrand<C>
Source§impl<ContinueType: 'static> Pointed for ControlFlowContinueAppliedBrand<ContinueType>
§Type Parameters
ContinueType: The continue type.
impl<ContinueType: 'static> Pointed for ControlFlowContinueAppliedBrand<ContinueType>
§Type Parameters
ContinueType: The continue type.
Source§fn pure<'a, A: 'a>(a: A) -> <Self as Kind_cdc7cd43dac7585f>::Of<'a, A>
fn pure<'a, A: 'a>(a: A) -> <Self as Kind_cdc7cd43dac7585f>::Of<'a, A>
Wraps a value in a control flow.
This method wraps a value in the Break variant of a ControlFlow.
§Type Signature
forall ContinueType A. A -> ControlFlowContinueApplied ContinueType A
§Type Parameters
'a: The lifetime of the value.A: The type of the value to wrap.
§Parameters
a: The value to wrap.
§Returns
Break(a).
§Examples
use {
core::ops::ControlFlow,
fp_library::{
brands::*,
functions::*,
},
};
assert_eq!(pure::<ControlFlowContinueAppliedBrand<()>, _>(5), ControlFlow::<_, ()>::Break(5));Source§impl<ContinueType: Clone + 'static> Semiapplicative for ControlFlowContinueAppliedBrand<ContinueType>
§Type Parameters
ContinueType: The continue type.
impl<ContinueType: Clone + 'static> Semiapplicative for ControlFlowContinueAppliedBrand<ContinueType>
§Type Parameters
ContinueType: The continue type.
Source§fn apply<'a, FnBrand: 'a + CloneFn, A: 'a + Clone, B: 'a>(
ff: <Self as Kind_cdc7cd43dac7585f>::Of<'a, <FnBrand as CloneFn>::Of<'a, A, B>>,
fa: <Self as Kind_cdc7cd43dac7585f>::Of<'a, A>,
) -> <Self as Kind_cdc7cd43dac7585f>::Of<'a, B>
fn apply<'a, FnBrand: 'a + CloneFn, A: 'a + Clone, B: 'a>( ff: <Self as Kind_cdc7cd43dac7585f>::Of<'a, <FnBrand as CloneFn>::Of<'a, A, B>>, fa: <Self as Kind_cdc7cd43dac7585f>::Of<'a, A>, ) -> <Self as Kind_cdc7cd43dac7585f>::Of<'a, B>
Applies a wrapped function to a wrapped value.
This method applies a function wrapped in a control flow to a value wrapped in a control flow.
§Type Signature
forall ContinueType A B. CloneFn FnBrand => (ControlFlowContinueApplied ContinueType (FnBrand A B), ControlFlowContinueApplied ContinueType A) -> ControlFlowContinueApplied ContinueType B
§Type Parameters
'a: The lifetime of the values.FnBrand: The brand of the cloneable function wrapper.A: The type of the input value.B: The type of the output value.
§Parameters
ff: The control flow containing the function.fa: The control flow containing the value.
§Returns
Break(f(a)) if both are Break, otherwise the first continue encountered.
§Examples
use {
core::ops::ControlFlow,
fp_library::{
brands::*,
classes::*,
functions::*,
},
};
let f: ControlFlow<_, ()> = ControlFlow::Break(lift_fn_new::<RcFnBrand, _, _>(|x: i32| x * 2));
assert_eq!(
apply::<RcFnBrand, ControlFlowContinueAppliedBrand<()>, _, _>(f, ControlFlow::Break(5)),
ControlFlow::Break(10)
);Source§impl<ContinueType: Clone + 'static> Semimonad for ControlFlowContinueAppliedBrand<ContinueType>
§Type Parameters
ContinueType: The continue type.
impl<ContinueType: Clone + 'static> Semimonad for ControlFlowContinueAppliedBrand<ContinueType>
§Type Parameters
ContinueType: The continue type.
Source§fn bind<'a, A: 'a, B: 'a>(
ma: <Self as Kind_cdc7cd43dac7585f>::Of<'a, A>,
func: impl Fn(A) -> <Self as Kind_cdc7cd43dac7585f>::Of<'a, B> + 'a,
) -> <Self as Kind_cdc7cd43dac7585f>::Of<'a, B>
fn bind<'a, A: 'a, B: 'a>( ma: <Self as Kind_cdc7cd43dac7585f>::Of<'a, A>, func: impl Fn(A) -> <Self as Kind_cdc7cd43dac7585f>::Of<'a, B> + 'a, ) -> <Self as Kind_cdc7cd43dac7585f>::Of<'a, B>
Chains control flow computations.
This method chains two computations, where the second computation depends on the result of the first.
§Type Signature
forall ContinueType A B. (ControlFlowContinueApplied ContinueType A, A -> ControlFlowContinueApplied ContinueType B) -> ControlFlowContinueApplied ContinueType B
§Type Parameters
'a: The lifetime of the values.A: The type of the result of the first computation.B: The type of the result of the second computation.
§Parameters
ma: The first control flow.func: The function to apply to the value inside the control flow.
§Returns
The result of applying f to the value if ma is Break, otherwise the original continue.
§Examples
use {
core::ops::ControlFlow,
fp_library::{
brands::*,
functions::*,
},
};
assert_eq!(
explicit::bind::<ControlFlowContinueAppliedBrand<()>, _, _, _, _>(
ControlFlow::Break(5),
|x| { ControlFlow::Break(x * 2) }
),
ControlFlow::<_, ()>::Break(10)
);Source§impl<ContinueType: Clone + 'static> Traversable for ControlFlowContinueAppliedBrand<ContinueType>
§Type Parameters
ContinueType: The continue type.
impl<ContinueType: Clone + 'static> Traversable for ControlFlowContinueAppliedBrand<ContinueType>
§Type Parameters
ContinueType: The continue type.
Source§fn traverse<'a, A: 'a + Clone, B: 'a + Clone, F: Applicative>(
func: impl Fn(A) -> <F as Kind_cdc7cd43dac7585f>::Of<'a, B> + 'a,
ta: <Self as Kind_cdc7cd43dac7585f>::Of<'a, A>,
) -> <F as Kind_cdc7cd43dac7585f>::Of<'a, <Self as Kind_cdc7cd43dac7585f>::Of<'a, B>>
fn traverse<'a, A: 'a + Clone, B: 'a + Clone, F: Applicative>( func: impl Fn(A) -> <F as Kind_cdc7cd43dac7585f>::Of<'a, B> + 'a, ta: <Self as Kind_cdc7cd43dac7585f>::Of<'a, A>, ) -> <F as Kind_cdc7cd43dac7585f>::Of<'a, <Self as Kind_cdc7cd43dac7585f>::Of<'a, B>>
Traverses the control flow with an applicative function.
This method maps the element of the control flow to a computation, evaluates it, and combines the result into an applicative context.
§Type Signature
forall ContinueType A B F. Applicative F => (A -> F B, ControlFlowContinueApplied ContinueType A) -> F (ControlFlowContinueApplied ContinueType B)
§Type Parameters
'a: The lifetime of the values.A: The type of the elements in the traversable structure.B: The type of the elements in the resulting traversable structure.F: The applicative context.
§Parameters
func: The function to apply.ta: The control flow to traverse.
§Returns
The control flow wrapped in the applicative context.
§Examples
use {
core::ops::ControlFlow,
fp_library::{
brands::*,
functions::*,
},
};
assert_eq!(
explicit::traverse::<RcFnBrand, ControlFlowContinueAppliedBrand<()>, _, _, OptionBrand, _, _>(
|x| Some(x * 2),
ControlFlow::Break(5)
),
Some(ControlFlow::Break(10))
);
assert_eq!(
explicit::traverse::<
RcFnBrand,
ControlFlowContinueAppliedBrand<i32>,
_,
_,
OptionBrand,
_,
_,
>(|x: i32| Some(x * 2), ControlFlow::Continue(1)),
Some(ControlFlow::Continue(1))
);Source§fn sequence<'a, A: 'a + Clone, F: Applicative>(
ta: <Self as Kind_cdc7cd43dac7585f>::Of<'a, <F as Kind_cdc7cd43dac7585f>::Of<'a, A>>,
) -> <F as Kind_cdc7cd43dac7585f>::Of<'a, <Self as Kind_cdc7cd43dac7585f>::Of<'a, A>>where
<F as Kind_cdc7cd43dac7585f>::Of<'a, A>: Clone,
<Self as Kind_cdc7cd43dac7585f>::Of<'a, A>: Clone,
fn sequence<'a, A: 'a + Clone, F: Applicative>(
ta: <Self as Kind_cdc7cd43dac7585f>::Of<'a, <F as Kind_cdc7cd43dac7585f>::Of<'a, A>>,
) -> <F as Kind_cdc7cd43dac7585f>::Of<'a, <Self as Kind_cdc7cd43dac7585f>::Of<'a, A>>where
<F as Kind_cdc7cd43dac7585f>::Of<'a, A>: Clone,
<Self as Kind_cdc7cd43dac7585f>::Of<'a, A>: Clone,
Sequences a control flow of applicative.
This method evaluates the computation inside the control flow and accumulates the result into an applicative context.
§Type Signature
forall ContinueType A F. Applicative F => ControlFlowContinueApplied ContinueType (F A) -> F (ControlFlowContinueApplied ContinueType A)
§Type Parameters
'a: The lifetime of the values.A: The type of the elements in the traversable structure.F: The applicative context.
§Parameters
ta: The control flow containing the applicative value.
§Returns
The control flow wrapped in the applicative context.
§Examples
use {
core::ops::ControlFlow,
fp_library::{
brands::*,
functions::*,
},
};
assert_eq!(
sequence::<ControlFlowContinueAppliedBrand<()>, _, OptionBrand>(ControlFlow::Break(Some(
5
))),
Some(ControlFlow::Break(5))
);
assert_eq!(
sequence::<ControlFlowContinueAppliedBrand<i32>, i32, OptionBrand>(ControlFlow::<
Option<i32>,
i32,
>::Continue(1)),
Some(ControlFlow::<i32, i32>::Continue(1))
);impl<C: Copy> Copy for ControlFlowContinueAppliedBrand<C>
impl<C: Eq> Eq for ControlFlowContinueAppliedBrand<C>
impl<C> StructuralPartialEq for ControlFlowContinueAppliedBrand<C>
Auto Trait Implementations§
impl<C> Freeze for ControlFlowContinueAppliedBrand<C>
impl<C> RefUnwindSafe for ControlFlowContinueAppliedBrand<C>where
C: RefUnwindSafe,
impl<C> Send for ControlFlowContinueAppliedBrand<C>where
C: Send,
impl<C> Sync for ControlFlowContinueAppliedBrand<C>where
C: Sync,
impl<C> Unpin for ControlFlowContinueAppliedBrand<C>where
C: Unpin,
impl<C> UnsafeUnpin for ControlFlowContinueAppliedBrand<C>
impl<C> UnwindSafe for ControlFlowContinueAppliedBrand<C>where
C: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more