makeObserver

The helper for the own observer.

Examples

1 int countPut = 0;
2 int countCompleted = 0;
3 int countFailure = 0;
4 
5 auto observer = makeObserver((int) { countPut++; }, () { countCompleted++; }, (Exception) {
6     countFailure++;
7 });
8 
9 .put(observer, 0);
10 assert(countPut == 1);
11 
12 observer.completed();
13 assert(countCompleted == 1);
14 
15 observer.failure(null);
16 assert(countFailure == 1);