CompositeObserver

Constructors

this
this(Observer!E[] observers)

Members

Functions

add
CompositeObserver!E add(Observer!E observer)
completed
void completed()
failure
void failure(Exception e)
observers
Observer!E[] observers()
put
void put(E obj)
remove
Observer!E remove(Observer!E observer)
removeStrict
CompositeObserver!E removeStrict(Observer!E observer)

Static functions

empty
CompositeObserver!E empty()

Examples

int count = 0;
struct TestObserver
{
    void put(int n)
    {
        count++;
    }
}

auto c1 = new CompositeObserver!int;
c1.put(0);
auto o1 = observerObject!int(TestObserver());
auto c2 = c1.add(o1);
c1.put(0);
assert(count == 0);
c2.put(0);
assert(count == 1);
auto c3 = c2.add(observerObject!int(TestObserver()));
c3.put(0);
assert(count == 3);
auto c4 = c3.remove(o1);
c4.put(0);
assert(count == 4);

Meta