drop

Creates the observable that results from discarding the first n elements from the given source.

drop
(
TObservable
)
(
auto ref TObservable observable
,
size_t n
)

Examples

import rx.subject;

auto subject = new SubjectObject!int;
auto dropped = subject.drop(1);
static assert(isObservable!(typeof(dropped), int));

import std.array : appender;

auto buf = appender!(int[]);
auto disposable = dropped.subscribe(buf);

subject.put(0);
assert(buf.data.length == 0);
subject.put(1);
assert(buf.data.length == 1);

auto buf2 = appender!(int[]);
dropped.subscribe(buf2);
assert(buf2.data.length == 0);
subject.put(2);
assert(buf2.data.length == 0);
assert(buf.data.length == 2);
subject.put(3);
assert(buf2.data.length == 1);
assert(buf.data.length == 3);

Meta