asReplaySubject

asReplaySubject
(
TObservable
)
(
auto ref TObservable observable
,
size_t bufferSize
)

Examples

1 import rx;
2 
3 auto sub = defer!(int, (observer) {
4     observer.put(10);
5     observer.put(20);
6     observer.put(30);
7     observer.completed();
8     return NopDisposable.instance;
9 });
10 
11 ReplaySubject!int nums = sub.asReplaySubject(4);
12 
13 int[] data;
14 nums.doSubscribe!(x => data ~= x);
15 
16 assert(data == [10, 20, 30]);
1 import rx;
2 
3 auto sub = defer!(int, (observer) {
4     observer.put(10);
5     observer.put(20);
6     observer.put(30);
7     observer.failure(null);
8     return NopDisposable.instance;
9 });
10 
11 ReplaySubject!int nums = sub.asReplaySubject(2);
12 
13 int[] data;
14 nums.doSubscribe!(x => data ~= x);
15 
16 assert(data == [20, 30]);