tee

template tee(alias f)
TeeObservable!(f, TObservable, TObservable.ElementType)
tee
(
TObservable
)
(
auto ref TObservable observable
)

Members

Functions

tee
TeeObservable!(f, TObservable, TObservable.ElementType) tee(TObservable observable)
Undocumented in source. Be warned that the author may not have intended to support it.

Examples

import rx.subject : SubjectObject;

auto sub = new SubjectObject!int;

import std.array : appender;

auto buf1 = appender!(int[]);
auto buf2 = appender!(int[]);

import rx.algorithm : map;

auto disposable = sub.tee!(i => buf1.put(i))().map!(i => i * 2)().subscribe(buf2);

sub.put(1);
sub.put(2);
disposable.dispose();
sub.put(3);

import std.algorithm : equal;

assert(equal(buf1.data, [1, 2]));
assert(equal(buf2.data, [2, 4]));

Meta