Enum plumbum::ConduitM 
            
                [−]
            
        [src]
pub enum ConduitM<'a, I, O, A> {
    Pure(Box<A>),
    Defer(Kleisli<'a, (), I, O, A>),
    Flush(Kleisli<'a, (), I, O, A>),
    Await(Kleisli<'a, Chunk<Vec<I>>, I, O, A>),
    Yield(Vec<O>, Kleisli<'a, (), I, O, A>),
    Leftover(Vec<I>, Kleisli<'a, (), I, O, A>),
}Represents a conduit, i.e. a sequence of await/yield actions.
- Iis the type of values the conduit consumes from upstream.
- Ois the type of values the conduit passes downstream.
- Ais the return type of the conduit.
Variants
| Pure | The case  | 
| Defer | The case  | 
| Flush | The case  | 
| Await | The case  | 
| Yield | The case  | 
| Leftover | The case  | 
Methods
impl<'a, O> ConduitM<'a, Void, O, ()>
fn to_producer<I>(self) -> ConduitM<'a, I, O, ()> where O: 'static
Generalize a Source by universally quantifying the input type.
fn connect<A>(self, sink: Sink<'a, O, A>) -> A where O: 'static
Pulls data from the source and pushes it into the sink.
Example
use std::iter::FromIterator; use plumbum::{Source, Sink, produce}; let src = Source::from_iter(vec![42, 43]); let sink = Sink::fold(0, |x, y| x + y); assert_eq!(src.connect(sink), 85);
impl<'a, I, O> ConduitM<'a, I, O, ()>
fn fuse<P, A>(self, other: ConduitM<'a, O, P, A>) -> ConduitM<'a, I, P, A> where I: 'static, O: 'static, P: 'static, A: 'a
Combines two conduits together into a new conduit.
Example
use std::iter::FromIterator; use plumbum::{Conduit, Source, Sink}; let src = Source::from_iter(vec![42, 43]); let conduit = Conduit::transform(|x| 1 + x); let sink = Sink::fold(0, |x, y| x + y); assert_eq!(src.fuse(conduit).connect(sink), 87);
fn transform<F>(f: F) -> Self where I: 'a, O: 'a, F: 'a + Fn(I) -> O
Apply a transformation to all values in a stream.
impl<'a, I, A> ConduitM<'a, I, Void, A>
fn to_consumer<O>(self) -> ConduitM<'a, I, O, A> where I: 'static, A: 'a
Generalize a Sink by universally quantifying the output type.
fn fold<F>(a: A, f: F) -> Self where I: 'a, A: 'a, F: 'a + Fn(A, I) -> A
Fold all values from upstream into a final value.
impl<'a, I, O, A> ConduitM<'a, I, O, A>
fn and_then<B, F>(self, js: F) -> ConduitM<'a, I, O, B> where F: 'a + FnOnce(A) -> ConduitM<'a, I, O, B>
Appends a continuation to a conduit. Which means,
given a function from A to ConduitM<I, O, B>,
passes the return value of the conduit to the function,
and returns the resulting program.
fn and<B: 'a>(self, other: ConduitM<'a, I, O, B>) -> ConduitM<'a, I, O, B> where I: 'a, O: 'a
Appends two conduits together, which means, it returns a new conduit that executes both conduits sequentially, and forwards the return value of the second.
fn zip<B: 'a>(self, other: ConduitM<'a, I, O, B>) -> ConduitM<'a, I, O, (A, B)> where A: 'a, I: 'a, O: 'a
Zips two conduits together, which means, it returns a new conduit that executes both conduits sequentially, and forwards both return values.
fn map<B, F>(self, f: F) -> ConduitM<'a, I, O, B> where F: 'a + FnOnce(A) -> B
Modifies the return value of the conduit.
Seen differently, it lifts a function from
A to B into a function from ConduitM<I, O, A>
to ConduitM<I, O, B>.