Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

operator_take

crates.io ci codecov license

Emit only the first n values, then complete.

See Also

Example

cargo run -p rx_core --example operator_take_example
let _subscription = (1..=5)
    .into_observable()
    .take(2)
    .subscribe(PrintObserver::new("take_operator"));

Output:

take_operator - next: 1
take_operator - next: 2
take_operator - completed
take_operator - unsubscribed