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

Provide a `SignalMut` to expose the result of `scan_mut` sanely #62

Merged
merged 3 commits into from May 12, 2015

Conversation

Projects
None yet
1 participant
@aepsil0n
Owner

aepsil0n commented May 12, 2015

Fixes #61. See commit messages for details.

aepsil0n added some commits May 12, 2015

Make snapshot take a function
Instead of snapshot always producing a tuple, the way its input values are
combined can now be specified by passing a combining function. This is a
breaking change.

All code like

    signal.snapshot(&stream)

must be replaced by

    signal.snapshot(&stream, |a, b| (a, b))

However, a pattern like

    signal.snapshot(&stream).map(|(a, b)| f(a, b))

simplifies to

    signal.snapshot(&stream, f)
Wrap Signal<ReadOnly> as SignalMut
With the new interface there is less risk of using the interface in a manner
that is inconsistent with the FRP abstraction. The SignalMut is much more
restricted to guarantee this.

Note that one can still use Signal<ReadOnly> or Signal<Mutex> to side-step
this. But this is no longer part of the API and highly discouraged.
Make ReadOnly items private
They are no longer required by the rest of the API and merely serve the purpose
of providing internal guarantees for the implementation.

@aepsil0n aepsil0n added the breaking label May 12, 2015

aepsil0n added a commit that referenced this pull request May 12, 2015

Merge pull request #62 from aepsil0n/saner-scan-mut
Provide a `SignalMut` to expose the result of `scan_mut` sanely

@aepsil0n aepsil0n merged commit ef474b8 into master May 12, 2015

2 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details

@aepsil0n aepsil0n deleted the saner-scan-mut branch May 12, 2015

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