1 module rx.algorithm; 2 3 public import rx.algorithm.all; 4 public import rx.algorithm.any; 5 public import rx.algorithm.buffer; 6 public import rx.algorithm.combineLatest; 7 public import rx.algorithm.debounce; 8 public import rx.algorithm.filter; 9 public import rx.algorithm.fold; 10 public import rx.algorithm.groupby; 11 public import rx.algorithm.map; 12 public import rx.algorithm.merge; 13 public import rx.algorithm.scan; 14 public import rx.algorithm.tee; 15 public import rx.algorithm.uniq; 16 17 //#################### 18 // Overview 19 //#################### 20 /// 21 unittest 22 { 23 import rx; 24 import std.conv : to; 25 import std.range : iota, put; 26 27 auto subject = new SubjectObject!int; 28 29 string[] result; 30 auto disposable = subject.filter!(n => n % 2 == 0).map!(o => to!string(o)) 31 .doSubscribe!(text => result ~= text); 32 33 scope (exit) 34 disposable.dispose(); 35 36 put(subject, iota(10)); 37 38 assert(result == ["0", "2", "4", "6", "8"]); 39 } 40 41 /// 42 unittest 43 { 44 import rx; 45 46 auto sub = new SubjectObject!int; 47 48 auto hasEven = sub.any!"a % 2 == 0"(); 49 auto result = false; 50 auto disposable = hasEven.doSubscribe((bool b) { result = b; }); 51 scope (exit) 52 disposable.dispose(); 53 54 sub.put(1); 55 sub.put(3); 56 sub.put(2); 57 assert(result); 58 }