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

Conversation

1 participant
@brunocodutra
Copy link
Owner

brunocodutra commented Jan 15, 2019

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

This comment has been minimized.

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

This comment has been minimized.

Copy link
Owner

brunocodutra commented Jan 16, 2019

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

@brunocodutra brunocodutra force-pushed the async branch 3 times, most recently from 8029b63 to a2c2a80 Jan 17, 2019

@brunocodutra brunocodutra changed the title [WIP] Integrate with futures-rs Integrate with futures-rs Jan 20, 2019

@brunocodutra brunocodutra merged commit df7a34f into master Jan 23, 2019

4 checks passed

codecov/patch No report found to compare against
Details
codecov/project No report found to compare against
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details

@brunocodutra brunocodutra deleted the async branch Jan 26, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment