An introduction to marble diagrams for visual representation
It is difficult to visualize reactive Streams, as the data flows asynchronously. The designers of Rx systems have created a set of visualization cues called marble diagrams:
//------------------ Map.cpp #include "rxcpp/rx.hpp" #include "rxcpp/rx-test.hpp" #include <ioStream> #include <array> int main() { auto ints = rxcpp::observable<>::range(1,10). map( [] ( int n ) {return n*n; }); ints.subscribe( [](int v){printf("OnNext: %dn", v);}, [](){printf("OnCompletedn");}); }
Rather than giving a description of marble diagrams, let's look at a marble diagram that depicts the map
operator:

The top part of the marble diagram shows two timelines, and those timelines will be combined together by appending the contents of the second timeline to the first time line to form a composite timeline.