struct TestObserver { void put(int n) { } } struct TestObservable1 { alias ElementType = int; Disposable subscribe(Observer!int observer) { return null; } } struct TestObservable2 { alias ElementType = int; Disposable subscribe(T)(T observer) { return null; } } TestObservable1 o1; auto d0 = o1.doSubscribe((int n) { }, () { }, (Exception e) { }); auto d1 = o1.doSubscribe((int n) { }, () { }); auto d2 = o1.doSubscribe((int n) { }, (Exception e) { }); auto d3 = o1.doSubscribe((int n) { }); auto d4 = o1.doSubscribe(TestObserver()); TestObservable2 o2; auto d5 = o2.doSubscribe((int n) { }, () { }, (Exception e) { }); auto d6 = o2.doSubscribe((int n) { }, () { }); auto d7 = o2.doSubscribe((int n) { }, (Exception e) { }); auto d8 = o2.doSubscribe((int n) { }); auto d9 = o2.doSubscribe(TestObserver());
The helper for subscribe easier.