isObservable

Tests if something is a Observable.

  1. template isObservable(T, E)
    template isObservable (
    T
    E
    ) {
    enum bool isObservable;
    }
  2. template isObservable(TObservable)

Examples

1 struct TestObservable
2 {
3     alias ElementType = int;
4 
5     Disposable subscribe(T)(T observer)
6     {
7         static assert(isObserver!(T, int));
8         return null;
9     }
10 }
11 
12 static assert(isObservable!(TestObservable));
13 static assert(isObservable!(TestObservable, int));
14 static assert(!isObservable!(TestObservable, Object));
static assert(isObservable!(Observable!int));
static assert(!isObservable!(Observer!int));
static assert(!isObservable!(string));
static assert(!isObservable!(Object));