rx 0.5.0

Reactive Extensions for D Programming Language.

To use this package, put the following dependency into your project's dependencies section:


Reactive Extensions for D Programming Language

Dub version MIT License Build Status Coverage Status


This is a library like Rx.NET for asynchronous or event based programs, based on the concept of OutputRange.

The operators' name is based on std.algorithm and ReactiveX.

import rx;
import std.algorithm : equal;
import std.array : appender;
import std.conv : to;
import std.range : iota, put;

void main()
    auto subject = new SubjectObject!int;
    auto pub = subject
        .filter!(n => n % 2 == 0)
        .map!(o => to!string(o));

    auto buf = appender!(string[]);
    auto disposable = pub.doSubscribe(buf);

    put(subject, iota(10));

    auto result = buf.data;
    assert(equal(result, ["0", "2", "4", "6", "8"]));

And more examples or Documents


Setting dependencies in dub.json

    "dependencies": {
        "rx": "~>0.1.0"

or dub.sdl

dependency "rx" version="~>0.1.0"


Basic interfaces

All operators are written using template and struct for optimization. this example is a binary interface like std.range.interfaces.

//module rx.disposable
interface Disposable
    void dispose();

//module rx.observer
interface Observer(E) : OutputRange!E
    //void put(E obj); //inherits from OutputRange!E
    void completed();
    void failure(Exception e);

//module rx.observable
interface Observable(E)
    alias ElementType = E;
    Disposable subscribe(Observer!E observer);


This library is under the MIT License. Some code is borrowed from Rx.NET.

Future work

  • more subjects
  • behavior, publish, replay
  • more algorithms
  • more test
  • more documents

Authors: lempiji

Dependencies: none

0.5.0 2017-Jun-04
0.4.0 2017-Mar-23
0.3.0 2016-Dec-05
0.2.0 2016-Oct-10
0.1.0 2016-Sep-14
Show all 11 versions
  • 0 downloads today

  • 2 downloads this week

  • 3 downloads this month

  • 77 downloads total