Function sample::signal::lift
[−]
[src]
pub fn lift<I, F, S>(iter: I, f: F) -> UntilExhausted<S> where
I: IntoIterator,
I::Item: Frame,
F: FnOnce(FromIterator<I::IntoIter>) -> S,
S: Signal<Frame = I::Item>,
Consumes the given Iterator
, converts it to a Signal
, applies the given function to the
Signal
and returns an Iterator
that will become exhausted when the consumed Iterator
does.
This is particularly useful when you want to apply Signal
methods to an Iterator
yielding
Frame
s and return an Iterator
as a result.
Example
extern crate sample; use sample::{signal, Signal}; fn main() { let frames = vec![[0], [1], [2], [3]]; let offset_frames = signal::lift(frames, |signal| signal.offset_amp(2)); assert_eq!(offset_frames.collect::<Vec<_>>(), vec![[2], [3], [4], [5]]); }