Skip to content

Commit f518abd

Browse files
committedDec 20, 2016
Update readme with Perhaps info
1 parent 59b3d2f commit f518abd

File tree

1 file changed

+45
-4
lines changed

1 file changed

+45
-4
lines changed
 

‎README.md

+45-4
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,17 @@
33
<a href='https://travis-ci.org/akarnokd/RxJava2Extensions/builds'><img src='https://travis-ci.org/akarnokd/RxJava2Extensions.svg?branch=master'></a>
44
[![codecov.io](http://codecov.io/github/akarnokd/RxJava2Extensions/coverage.svg?branch=master)](http://codecov.io/github/akarnokd/RxJava2Extensions?branch=master)
55
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.github.akarnokd/rxjava2-extensions/badge.svg)](https://maven-badges.herokuapp.com/maven-central/com.github.akarnokd/rxjava2-extensions)
6+
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/io.reactivex.rxjava2/rxjava/badge.svg)](https://maven-badges.herokuapp.com/maven-central/io.reactivex.rxjava2/rxjava)
67

7-
Extra sources, operators and components and ports of many 1.x companion libraries for RxJava 2.x.
8+
RxJava 2.x implementation of extra sources, operators and components and ports of many 1.x companion libraries.
89

910
# Releases
1011

1112
**gradle**
1213

1314
```
1415
dependencies {
15-
compile "com.github.akarnokd:rxjava2-extensions:0.13.0"
16+
compile "com.github.akarnokd:rxjava2-extensions:0.14.0"
1617
}
1718
```
1819

@@ -736,7 +737,7 @@ ts.assertResult();
736737

737738
The `Publisher`-based sibling of the `Single` type. The usage is practically the same as `Single` with the exception that because `Solo` implements the Reactive-Streams `Publisher`, you can use it directly with operators of `Flowable` that accept `Publisher` in some form.
738739

739-
`Solo`'s emission protocol is a restriction over the general `Publisher` protocol: one either calls `onNext` followed by `onComplete` or just `onError`. Operators will and should never call `onNext` followed by `onError` or `onComplete` on its own. Note that some operators may react to `onNext` immediately not waiting for an `onComplete` but on their emission side, `onComplete` is always called.
740+
`Solo`'s emission protocol is a restriction over the general `Publisher` protocol: one either calls `onNext` followed by `onComplete` or just `onError`. Operators will and should never call `onNext` followed by `onError` or `onComplete` on its own. Note that some operators may react to `onNext` immediately not waiting for an `onComplete` but on their emission side, `onComplete` is always called after an `onNext`.
740741
741742
Examples:
742743
@@ -772,6 +773,46 @@ ts.assertResult(1);
772773
773774
### Perhaps - 0-1-error publisher
774775
775-
In progress...
776+
The `Publisher`-based sibling of the `Maybe` type. The usage is practically the same as `Maybe` with the exception that because `Perhaps` implements the Reactive-Streams `Publisher`, you can use it directly with operators of `Flowable` that accept `Publisher` in some form.
776777
778+
`Perhaps`'s emission protocol is a restriction over the general `Publisher` protocol: one either calls `onNext` followed by `onComplete`, `onComplete` only or just `onError`. Operators will and should never call `onNext` followed by `onError` on its own. Note that some operators may react to `onNext` immediately not waiting for an `onComplete` but on their emission side, `onComplete` is always called after an `onNext`.
779+
780+
Examples:
781+
782+
```java
783+
Perhaps.fromCallable(() -> {
784+
System.out.println("Hello world!");
785+
return 1;
786+
}).subscribe();
787+
788+
Perhaps.fromCallable(() -> "Hello world!")
789+
.delay(1, TimeUnit.SECONDS)
790+
.blockingSubscribe(System.out::println);
791+
792+
Flowable.concat(Perhaps.just(1), Perhaps.just(2))
793+
.test()
794+
.assertResult(1, 2);
795+
796+
Perhaps.fromCallable(() -> {
797+
System.out.println("Hello world!");
798+
return null; // null is considered to indicate an empty Perhaps
799+
})
800+
.test()
801+
.assertResult();
802+
```
803+
804+
#### PerhapsProcessor
805+
806+
A hot, Reactive-Streams `Processor` implementation of `Perhaps`.
807+
808+
```java
809+
PerhapsProcessor<Integer> ph = PerhapsProcessor.create();
810+
811+
TestSubscriber<Integer> ts = ph.test();
812+
813+
ph.onNext(1);
814+
ph.onComplete();
815+
816+
ts.assertResult(1);
817+
```
777818

0 commit comments

Comments
 (0)
Please sign in to comment.