frappe - FRP library for Rust
Functional Reactive Programming library inspired by Carboxyl.
It's designed to efficiently pass objects around by avoiding cloning as much as possible.
Threading is now supported (experimental), so streams and signals can be freely moved and used
between threads.
Work in progress, so the API can change at any time.
Usage
use frappe::Sink;
fn main() {
let sink = Sink::new();
let stream = sink.stream().inspect(|a| println!("--sent: {}", a));
let last = stream.hold(0);
let sum = stream.fold(0, |acc, n| acc + *n);
let half_even = stream
.filter(|n| n % 2 == 0)
.map(|n| *n / 2)
.fold(Vec::new(), |mut vec, n| {
vec.push(*n);
vec
});
sink.send(6);
sink.send(42);
sink.send(-1);
sink.feed(10..15);
println!("last: {}", last.sample());
println!("sum: {}", sum);
println!("half_even: {:?}", half_even);
}