ObservableSource!int oint; ObservableSource!string ostr; auto observer = merge(oint, ostr) .subscribe(); oint.put(1); ostr.put("foo"); oint.put(2); oint.put(3); oint.close(); ostr.put("bar"); ostr.close(); assert(observer.consumeOne.value!int == 1); assert(observer.consumeOne.value!string == "foo"); assert(observer.consumeOne.value!int == 2); assert(observer.consumeOne.value!int == 3); assert(observer.consumeOne.value!string == "bar"); assert(observer.empty);
Combines multiple observers into one.
The events of the input observables will be stored in a TaggedUnion and will be emitted by the combined observable interleaved in the same order as they occurred.
The values of the tagged union can be accessed using evt.observer0Value, evt.observer1Value etc., or by type using evt.value!T, with T being the event type of one or more of the source observers.