1 import rx.subject; 2 3 auto subject = new SubjectObject!int; 4 auto dropped = subject.drop(1); 5 static assert(isObservable!(typeof(dropped), int)); 6 7 import std.array : appender; 8 9 auto buf = appender!(int[]); 10 auto disposable = dropped.subscribe(buf); 11 12 subject.put(0); 13 assert(buf.data.length == 0); 14 subject.put(1); 15 assert(buf.data.length == 1); 16 17 auto buf2 = appender!(int[]); 18 dropped.subscribe(buf2); 19 assert(buf2.data.length == 0); 20 subject.put(2); 21 assert(buf2.data.length == 0); 22 assert(buf.data.length == 2); 23 subject.put(3); 24 assert(buf2.data.length == 1); 25 assert(buf.data.length == 3);
Creates the observable that results from discarding the first n elements from the given source.