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]));