Struct signalo_filters::sink::Integrate[][src]

pub struct Integrate<T> { /* fields omitted */ }

A sink that computes the integrate of all received values of a signal.

Example:

use signalo_filters::prelude::Source;
use signalo_filters::prelude::Sink;

use signalo_filters::source::Increment;
let increment: Increment<_> = Increment::new(0, 1);
// ╭───╮  ╭───╮  ╭───╮  ╭───╮  ╭───╮
// │ 0 │─▶│ 1 │─▶│ 2 │─▶│ 3 │─▶│ 4 │─▶ ...
// ╰───╯  ╰───╯  ╰───╯  ╰───╯  ╰───╯

use signalo_filters::source::Take;
let mut take: Take<_> = Take::new(increment, 3);
// ╭───╮  ╭───╮  ╭───╮
// │ 0 │─▶│ 1 │─▶│ 2 │
// ╰───╯  ╰───╯  ╰───╯

use signalo_filters::sink::Integrate;
let mut integrate = Integrate::default();
while let Some(value) = take.source() {
    integrate.sink(value);
}
assert_eq!(integrate.finalize(), Some(3));

Trait Implementations

impl<T: Clone> Clone for Integrate<T>
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl<T: Default> Default for Integrate<T>
[src]

Returns the "default value" for a type. Read more

impl<T: Debug> Debug for Integrate<T>
[src]

Formats the value using the given formatter. Read more

impl<T> Sink<T> for Integrate<T> where
    T: Copy + Num
[src]

The sink's output type.

Processes the input value.

Consumes self, returning an accumulated output.

Auto Trait Implementations

impl<T> Send for Integrate<T> where
    T: Send

impl<T> Sync for Integrate<T> where
    T: Sync