2.x: add subjects for Single, Maybe and Completable #4967

Merged
merged 2 commits into from Jan 8, 2017

Projects

None yet

4 participants

@akarnokd
Member
akarnokd commented Jan 6, 2017

This PR adds 3 new subject types: SingleSubject, MaybeSubject and CompletableSubject. Their purpose is to provide an imperative way to multicast 0-1-error events as well as cache these events for later observers. They are thread-safe by design and there is no need for a serialized wrapper unlike the other Subjects.

@akarnokd akarnokd added this to the 2.1 milestone Jan 6, 2017
@codecov-io
codecov-io commented Jan 6, 2017 edited

Current coverage is 95.56% (diff: 96.83%)

Merging #4967 into 2.x will decrease coverage by 0.08%

@@                2.x      #4967   diff @@
==========================================
  Files           587        591     +4   
  Lines         37671      37959   +288   
  Methods           0          0          
  Messages          0          0          
  Branches       5676       5756    +80   
==========================================
+ Hits          36031      36276   +245   
- Misses          696        717    +21   
- Partials        944        966    +22   

Powered by Codecov. Last update b917754...d272533

+ * Creates a fresh CompletableSubject.
+ * @return the new CompletableSubject instance
+ */
+ public static CompletableSubject create() {
@vanniktech
vanniktech Jan 7, 2017 Contributor

Should this be annotated with @CheckReturnValue ?

+
+ @Test
+ public void once() {
+ CompletableSubject ms = CompletableSubject.create();
@vanniktech
vanniktech Jan 7, 2017 Contributor

should not all of those be cs instead of ms for MaybeSubject ?

+
+ @Test
+ public void success() {
+ SingleSubject<Integer> ms = SingleSubject.create();
@vanniktech
vanniktech Jan 7, 2017 Contributor

also here should be ss

@akarnokd
Member
akarnokd commented Jan 7, 2017

@vanniktech updated.

@akarnokd akarnokd merged commit d173b6d into ReactiveX:2.x Jan 8, 2017

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
@akarnokd akarnokd deleted the akarnokd:ExtraSubjects branch Jan 8, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment