pub struct FilterOperator<D> where
D: Data + for<'a> Deserialize<'a>, { /* private fields */ }
Expand description
Filters an incoming stream of type D, retaining messages in the stream that the provided condition function evaluates to true when applied.
Example
The below example shows how to use a FilterOperator to keep only messages > 10 in an incoming stream of usize messages, and send them.
// Add the mapping function as an argument to the operator via the OperatorConfig.
let filter_config = OperatorConfig::new().name("FilterOperator");
let filter_stream = erdos::connect_one_in_one_out(
|| -> FilterOperator<usize> { FilterOperator::new(|a: &usize| -> bool { a > &10 }) },
|| {},
filter_config,
&source_stream,
);
Implementations
Trait Implementations
sourceimpl<D> OneInOneOut<(), D, D> for FilterOperator<D> where
D: Data + for<'a> Deserialize<'a>,
impl<D> OneInOneOut<(), D, D> for FilterOperator<D> where
D: Data + for<'a> Deserialize<'a>,
fn on_data(&mut self, ctx: &mut OneInOneOutContext<'_, (), D>, data: &D)
fn on_watermark(&mut self, _ctx: &mut OneInOneOutContext<'_, (), D>)
fn setup(&mut self, setup_context: &mut SetupContext<S>)
fn run(
&mut self,
config: &OperatorConfig,
read_stream: &mut ReadStream<T>,
write_stream: &mut WriteStream<U>
)
fn destroy(&mut self)
Auto Trait Implementations
impl<D> !RefUnwindSafe for FilterOperator<D>
impl<D> Send for FilterOperator<D>
impl<D> Sync for FilterOperator<D>
impl<D> Unpin for FilterOperator<D>
impl<D> !UnwindSafe for FilterOperator<D>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more