Crates.io | fgr |
lib.rs | fgr |
version | 0.3.1 |
source | src |
created_at | 2021-06-26 14:35:04.622523 |
updated_at | 2021-07-31 15:18:41.114208 |
description | Fine-grained reactivity for Rust |
homepage | |
repository | https://github.com/clinuxrulz/fgr4rs |
max_upload_size | |
id | 415162 |
size | 18,869 |
Based on: https://indepth.dev/posts/1269/finding-fine-grained-reactive-programming
Example:
fn main() {
let mut a = Signal::new(1);
let mut b = Signal::new(2);
let c;
{
let a = a.clone();
let b = b.clone();
c = Memo::new(move || *a.read() + *b.read());
}
let _effect = Effect::new(move || println!("{}", *c.read()));
*a.write() = 3;
batch(|| {
*a.write() = 10;
*b.write() = 12;
});
}
Will Output:
3
5
22