hydroflow icon indicating copy to clipboard operation
hydroflow copied to clipboard

need a tick-based version of `defer_signal`

Open jhellerstein opened this issue 1 year ago • 0 comments

E.g. I only want to send the most recent result of a fold when I receive a message, not all values of the fold.

items = source_iter(itemsrc) -> fold(|| 0, |accum, item| accum += 1) -> [input]gate;
source_iter(querysrc) -> [signal]gate;
gate = defer_signal() -> for_each(|x| println!('{}', x);

With the current defer_signal I will print out all the counts 1, 2, 3, 4, .... If I had defer_signal::<'tick> I'd only output the most recent count when a querysrc msg arrives.

Not sure defer_signal::<'tick> is a good name, but I can't think of a better name that encompasses both.

jhellerstein avatar Nov 20 '23 20:11 jhellerstein