Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrate with futures-rs #11

Merged
merged 5 commits into from
Jan 23, 2019
Merged

Integrate with futures-rs #11

merged 5 commits into from
Jan 23, 2019

Conversation

brunocodutra
Copy link
Owner

The goal of this PR is to make it convenient to asynchronously dispatch actions against a store that is running on a background thread[pool]:

#![feature(async_await, await_macro, futures_api)]
use reducer::*;

let store = AsyncStore::new(Calculator(0), Display);

// Process incoming actions on a background thread.
let mut dispatcher = store.spawn_thread().unwrap();

let compute = async {
    await!(dispatcher.dispatch(Action::Add(5)));
    await!(dispatcher.dispatch(Action::Mul(3)));
    await!(dispatcher.dispatch(Action::Sub(1)));
    await!(dispatcher.dispatch(Action::Div(7))); 
};

@codecov
Copy link

codecov bot commented Jan 16, 2019

Codecov Report

❗ No coverage uploaded for pull request base (master@4cdb9e3). Click here to learn what that means.
The diff coverage is 90.14%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master      #11   +/-   ##
=========================================
  Coverage          ?   95.62%           
=========================================
  Files             ?       18           
  Lines             ?      274           
  Branches          ?        0           
=========================================
  Hits              ?      262           
  Misses            ?       12           
  Partials          ?        0
Impacted Files Coverage Δ
src/dispatcher/mod.rs 100% <ø> (ø)
src/dispatcher/store.rs 100% <ø> (ø)
benches/async.rs 0% <0%> (ø)
src/dispatcher/async_store.rs 95.52% <95.52%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4cdb9e3...6ac8b6c. Read the comment docs.

@brunocodutra
Copy link
Owner Author

Tarpaulin seems to be segfaulting on thread related unit tests - xd009642/tarpaulin#190

@brunocodutra brunocodutra changed the title [WIP] Integrate with futures-rs Integrate with futures-rs Jan 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant