makeObserver

The helper for the own observer.

Examples

int countPut = 0;
int countCompleted = 0;
int countFailure = 0;

auto observer = makeObserver((int) { countPut++; }, () { countCompleted++; }, (Exception) {
    countFailure++;
});

.put(observer, 0);
assert(countPut == 1);

observer.completed();
assert(countCompleted == 1);

observer.failure(null);
assert(countFailure == 1);

Meta