frappe - FRP library for Rust
Frappe is a concurrent Event-Driven FRP library. It aims to provide a simple, efficient and
Rust-idiomatic way to write interactive applications in a declarative way.
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
}) .map(|v| format!("{:?}", v));
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);
}
You can also check the frappe-gtk examples
for more complex usage examples on GUI applications.