import rx;
auto sub = new SubjectObject!int;
size_t putCount = 0;
size_t disposedCount = 0;
auto disposable = sub.doSubscribe!(_ => putCount++)
.withDisposed!(() => disposedCount++);
sub.put(1);
disposable.dispose();
assert(putCount == 1);
assert(disposedCount == 1);
import rx;
auto sub = new SubjectObject!int;
size_t putCount = 0;
bool disposed = false;
alias traceDispose = withDisposed!(() => disposed = true);
auto disposable = traceDispose(sub.doSubscribe!(_ => putCount++));
sub.put(1);
sub.completed();
assert(putCount == 1);
assert(!disposed);
import rx;
auto sub = new SubjectObject!int;
size_t putCount = 0;
bool disposed = false;
alias traceDispose = withDisposed!(() => disposed = true);
auto disposable = traceDispose(sub.doSubscribe!(_ => putCount++));
sub.put(1);
disposable.dispose();
assert(putCount == 1);
assert(disposed);
import rx;
auto sub = new SubjectObject!int;
size_t putCount = 0;
bool disposed = false;
auto disposable = sub.doSubscribe!(_ => putCount++).withDisposed(() {
disposed = true;
});
sub.put(1);
disposable.dispose();
assert(putCount == 1);
assert(disposed);
import rx;
auto sub = new SubjectObject!int;
size_t disposedCount = 0;
auto disposable = sub.doSubscribe!((int) {})
.withDisposed!(() { disposedCount++; });
disposable.dispose();
disposable.dispose();
assert(disposedCount == 1);
import rx;
auto sub = new SubjectObject!int;
size_t putCount = 0;
bool disposed = false;
auto disposable = sub.doSubscribe!(_ => putCount++).withDisposed(() {
disposed = true;
});
sub.put(1);
disposable.dispose();
assert(putCount == 1);
assert(disposed);
import rx;
auto sub = new SubjectObject!int;
size_t disposedCount = 0;
auto disposable = sub.doSubscribe!((int) {}).withDisposed(() {
disposedCount++;
});
disposable.dispose();
disposable.dispose();
assert(disposedCount == 1);