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, and by
avoiding atomic operations (only Rc/RefCell used). Because of that threading is not directly supported,
but instead it provides methods to interface with channels.
Documentation
Usage
extern crate frappe;
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)
.collect::<Vec<_>>();
sink.send(6);
sink.send(42);
sink.send(-1);
sink.feed(10..15);
println!("last: {}", last.sample());
println!("sum: {}", sum);
half_even.sample_with(|v| println!("half_even: {:?}", v));
}