[][src]Trait rxrust::ops::take::Take

pub trait Take {
    fn take(self, count: u32) -> TakeOp<Self>
    where
        Self: Sized
, { ... } }

Emits only the first count values emitted by the source Observable.

take returns an Observable that emits only the first count values emitted by the source Observable. If the source emits fewer than count values then all of its values are emitted. After that, it completes, regardless if the source completes.

Example

Take the first 5 seconds of an infinite 1-second interval Observable

  ops::{Take}, prelude::*,
};

observable::from_range(0..10).take(5).subscribe(|v| println!("{}", v));

// print logs:
// 0
// 1
// 2
// 3
// 4

Provided methods

fn take(self, count: u32) -> TakeOp<Self> where
    Self: Sized

Loading content...

Implementors

impl<'a, O> Take for O where
    O: RawSubscribable
[src]

Loading content...