fgr

Crates.iofgr
lib.rsfgr
version0.3.1
sourcesrc
created_at2021-06-26 14:35:04.622523
updated_at2021-07-31 15:18:41.114208
descriptionFine-grained reactivity for Rust
homepage
repositoryhttps://github.com/clinuxrulz/fgr4rs
max_upload_size
id415162
size18,869
Clinton Selke (clinuxrulz)

documentation

README

Fine-grained Reactivity for Rust

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
Commit count: 17

cargo fmt