Trait gc_sequence::SequenceResultExt [−][src]
pub trait SequenceResultExt<'gc, I, E>: Sized + Sequence<'gc, Output = Result<I, E>> { fn map_ok<F, R>(self, f: F) -> MapOk<Self, F>
where
F: 'static + FnOnce(I) -> R, { ... } fn map_ok_with<C, F, R>(self, c: C, f: F) -> MapOkWith<Self, C, F>
where
F: 'static + FnOnce(C, I) -> R, { ... } fn map_err<F, R>(self, f: F) -> MapError<Self, F>
where
F: 'static + FnOnce(E) -> R, { ... } fn and_then<F, R>(self, f: F) -> AndThen<Self, F, I>
where
I: Collect,
F: 'static + FnOnce(MutationContext<'gc, '_>, I) -> Result<R, E>, { ... } fn and_then_with<C, F, R>(self, c: C, f: F) -> AndThenWith<Self, C, F, I>
where
C: Collect,
I: Collect,
F: 'static + FnOnce(MutationContext<'gc, '_>, C, I) -> Result<R, E>, { ... } fn and_chain<F, R, I2>(self, f: F) -> FlattenOk<AndThen<Self, F, I>, R>
where
I: Collect,
F: 'static + FnOnce(MutationContext<'gc, '_>, I) -> Result<R, E>,
R: Sequence<'gc, Output = Result<I2, E>>, { ... } fn and_chain_with<C, F, R, I2>(
self,
c: C,
f: F
) -> FlattenOk<AndThenWith<Self, C, F, I>, R>
where
C: Collect,
I: Collect,
F: 'static + FnOnce(MutationContext<'gc, '_>, C, I) -> Result<R, E>,
R: Sequence<'gc, Output = Result<I2, E>>, { ... } fn flatten_ok<I2>(self) -> FlattenOk<Self, I>
where
I: Sequence<'gc, Output = Result<I2, E>>, { ... } }
Extension trait for Sequences
producing a Result
that provides useful combinator methods.
Provided methods
fn map_ok<F, R>(self, f: F) -> MapOk<Self, F> where
F: 'static + FnOnce(I) -> R,
[src]
F: 'static + FnOnce(I) -> R,
Map a function over the result of this sequence if it is successful.
Similarly to SequenceExt::map
, this function is run in the same call to Sequence::step
.
fn map_ok_with<C, F, R>(self, c: C, f: F) -> MapOkWith<Self, C, F> where
F: 'static + FnOnce(C, I) -> R,
[src]
F: 'static + FnOnce(C, I) -> R,
Equivalent to SequenceResultExt::map_ok
, but takes a context parameter.
fn map_err<F, R>(self, f: F) -> MapError<Self, F> where
F: 'static + FnOnce(E) -> R,
[src]
F: 'static + FnOnce(E) -> R,
Map a function over the error result of this sequence, if it errors.
Similarly to SequenceExt::map
, this function is run in the same call to Sequence::step
.
fn and_then<F, R>(self, f: F) -> AndThen<Self, F, I> where
I: Collect,
F: 'static + FnOnce(MutationContext<'gc, '_>, I) -> Result<R, E>,
[src]
I: Collect,
F: 'static + FnOnce(MutationContext<'gc, '_>, I) -> Result<R, E>,
Execute another sequence step after this sequence completes successfully.
Similar to SequenceExt::then
but only calls the given function when this sequence
completes successfully.
fn and_then_with<C, F, R>(self, c: C, f: F) -> AndThenWith<Self, C, F, I> where
C: Collect,
I: Collect,
F: 'static + FnOnce(MutationContext<'gc, '_>, C, I) -> Result<R, E>,
[src]
C: Collect,
I: Collect,
F: 'static + FnOnce(MutationContext<'gc, '_>, C, I) -> Result<R, E>,
Equivalent to SequenceResultExt::and_then
, but calls the function with the given context
parameter.
fn and_chain<F, R, I2>(self, f: F) -> FlattenOk<AndThen<Self, F, I>, R> where
I: Collect,
F: 'static + FnOnce(MutationContext<'gc, '_>, I) -> Result<R, E>,
R: Sequence<'gc, Output = Result<I2, E>>,
[src]
I: Collect,
F: 'static + FnOnce(MutationContext<'gc, '_>, I) -> Result<R, E>,
R: Sequence<'gc, Output = Result<I2, E>>,
Call a function on the result of this sequence, producing a new sequence to run.
Similar to SequenceExt::chain
but only calls the given function when this sequence
completes successfully.
fn and_chain_with<C, F, R, I2>(
self,
c: C,
f: F
) -> FlattenOk<AndThenWith<Self, C, F, I>, R> where
C: Collect,
I: Collect,
F: 'static + FnOnce(MutationContext<'gc, '_>, C, I) -> Result<R, E>,
R: Sequence<'gc, Output = Result<I2, E>>,
[src]
self,
c: C,
f: F
) -> FlattenOk<AndThenWith<Self, C, F, I>, R> where
C: Collect,
I: Collect,
F: 'static + FnOnce(MutationContext<'gc, '_>, C, I) -> Result<R, E>,
R: Sequence<'gc, Output = Result<I2, E>>,
Equivalent to SequenceResultExt::and_then
, but calls the function with the given context
parameter.
fn flatten_ok<I2>(self) -> FlattenOk<Self, I> where
I: Sequence<'gc, Output = Result<I2, E>>,
[src]
I: Sequence<'gc, Output = Result<I2, E>>,
Similar to SequenceExt::flatten
, but this sequence must result in an Ok(next_sequence)
.
Implementors
impl<'gc, T, I, E> SequenceResultExt<'gc, I, E> for T where
T: Sequence<'gc, Output = Result<I, E>>,
[src]
impl<'gc, T, I, E> SequenceResultExt<'gc, I, E> for T where
T: Sequence<'gc, Output = Result<I, E>>,
[src]