IObserver

Members

Functions

onCompleted
void onCompleted()
onError
void onError(Exception error)
onNext
void onNext(T value)

Examples

int n, e, c;
class NumberObserver : IObserver!int
{
    import std.stdio;
    void onNext(int x) { n += x; }
    void onError(Exception err) { e++; }
    void onCompleted() { c++; }
}

auto o = new NumberObserver();

foreach (i; 0 .. 5)
    o.onNext(i);

o.onCompleted();

assert (n == 10);
assert (e == 0);
assert (c == 1);

Meta