Skip to content

not-elm/flurx

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

flurx

flurx is a library that incorporates an asynchronous flow called Reactor into the flux data flow.

Examples

All examples can be found here.

example reducer
#[tokio::main]
async fn main() {
    let mut store = Store::<usize>::default();
    let mut reducer = Reducer::<usize>::new(&mut store);

    reducer.schedule(|task| async move {
        println!("*** Start ***");

        task.will(wait::until(|state| {
            println!("count: {}", state);
            state == 10
        }))
            .await;
        println!("*** Finish ***");
    });

    for _ in 0..10 {
        reducer.dispatch(|state| {
            state + 1
        }).await;
    }
}

Scheduler is included in Reducer, but it can also be used alone. In that case, you can separate it from state management and use only Reactor's functionality.

example scheduler
#[tokio::main]
async fn main() {
    let mut scheduler = Scheduler::<usize>::new();
    scheduler.schedule(|task| async move {
        println!("*** Start ***");
        task.will(wait::until(|state| {
            println!("count: {}", state);
            state == 10
        })).await;
        println!("*** Finish ***");
    });

    for i in 0..=10 {
        scheduler.run(i).await;
    }
}

ChangeLog

Please see here.

License

This crate is licensed under the MIT License or the Apache License 2.0.

About

flurx is a library that incorporates an asynchronous flow called Reactor into the flux data flow.

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Packages

No packages published

Languages