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
}
}
}