Struct dyer::plugin::pipeline::PipeLine[][src]

pub struct PipeLine<'pl, I, C> where
    C: 'pl,
    I: Send + Sync + Debug + 'pl, 
{ pub open_pipeline: &'pl dyn Fn() -> LocalBoxFuture<'pl, &'pl Option<C>>, pub close_pipeline: &'pl dyn Fn() -> LocalBoxFuture<'pl, ()>, pub process_item: &'pl dyn Fn(&mut Arc<Mutex<Vec<I>>>) -> LocalBoxFuture<'_, ()>, pub process_yerr: &'pl dyn Fn(&mut Arc<Mutex<Vec<String>>>) -> LocalBoxFuture<'_, ()>, }

the end of data flow, plugin that consume the extracted Entity, In general, the default method does nothing, and customization is requird to store the data. An example:

async fn process_item(items: &mut Arc<Mutex<Vec<I>>>) {
    let itms = items.lock().unwrap();
    for _ in itms.len() {
        itms.pop();
    }
    println!("consumed {} items", itms.len() )
}
let pipeline = PipeLine::builder().process_item(&|items: &mut Arc<Mutex<Vec<I>>>|
process_item(items).boxed_local() );

the member not specified is by default assigned to the default method

Fields

open_pipeline: &'pl dyn Fn() -> LocalBoxFuture<'pl, &'pl Option<C>>close_pipeline: &'pl dyn Fn() -> LocalBoxFuture<'pl, ()>process_item: &'pl dyn Fn(&mut Arc<Mutex<Vec<I>>>) -> LocalBoxFuture<'_, ()>process_yerr: &'pl dyn Fn(&mut Arc<Mutex<Vec<String>>>) -> LocalBoxFuture<'_, ()>

Implementations

impl<'pl, I, C> PipeLine<'pl, I, C> where
    C: 'pl,
    I: Send + Sync + Debug + 'pl, 
[src]

pub fn builder() -> PipeLineBuilder<'pl, ((), (), (), ()), I, C>[src]

Create a builder for building PipeLine. On the builder, call .open_pipeline(...)(optional), .close_pipeline(...)(optional), .process_item(...)(optional), .process_yerr(...)(optional) to set the values of the fields. Finally, call .build() to create the instance of PipeLine.

Auto Trait Implementations

impl<'pl, I, C> !RefUnwindSafe for PipeLine<'pl, I, C>

impl<'pl, I, C> !Send for PipeLine<'pl, I, C>

impl<'pl, I, C> !Sync for PipeLine<'pl, I, C>

impl<'pl, I, C> Unpin for PipeLine<'pl, I, C>

impl<'pl, I, C> !UnwindSafe for PipeLine<'pl, I, C>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,