Trait ppl::pipeline::node::Out

source ·
pub trait Out<TOut>
where TOut: 'static + Send,
{ // Required method fn run(&mut self) -> Option<TOut>; }
Expand description

Trait defining a node that output data.

§Examples:

A node emitting a vector containing numbers from 0 to 99 for streamlen times:

use ppl::prelude::*;
struct Source {
     streamlen: usize,
     counter: usize,
}
impl Out<Vec<i32>> for Source {
     fn run(&mut self) -> Option<Vec<i32>> {
         if self.counter < self.streamlen {
             self.counter = self.counter + 1;
             Some((0..99).collect())
         } else {
             None
         }
    }
 }

Required Methods§

source

fn run(&mut self) -> Option<TOut>

This method is called by the rts until a None is returned. When None is returned, the node will terminate.

Implementors§

source§

impl<I, T> Out<T> for SourceIter<I, T>
where I: Iterator<Item = T>, T: Send + 'static,

source§

impl<TOut, F> Out<TOut> for F
where F: FnMut() -> Option<TOut>, TOut: 'static + Send,