Function indicator::ticked::array::array_t

source ·
pub fn array_t<F, I, T, P, const LEN: usize>(f: F) -> Array<I, P, LEN>where
    I: Tickable<Value = [T; LEN]>,
    P: Operator<TickValue<T>>,
    P::Output: Tickable,
    F: FnMut() -> P,
Expand description

Apply a ticked operator on an array input to get an array of output.

use indicator::*;

fn plus_one<M, I, Q>(mode: M) -> impl Operator<I, Output = TickValue<[usize; 3]>>
where
    M: TumblingWindow,
    I: Tickable<Value = usize>,
    Q: QueueCapAtLeast<0, Item = usize>,
{
    cached(mode, |_q: &Q, _n, x: &usize| [*x, *x, *x])
        .then(array_t(|| map_t(|x| x + 1)))
}