Struct ZipOp

Source
pub struct ZipOp<A, B> { /* private fields */ }
Expand description

An Observable that combines from two other two Observables.

This struct is created by the zip method on Observable. See its documentation for more.

Trait Implementations§

Source§

impl<A: Clone, B: Clone> Clone for ZipOp<A, B>

Source§

fn clone(&self) -> ZipOp<A, B>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a, A, B> LocalObservable<'a> for ZipOp<A, B>
where A: LocalObservable<'a>, B: LocalObservable<'a, Err = A::Err>, A::Item: 'a, B::Item: 'a,

Source§

type Unsub = LocalSubscription

Source§

fn actual_subscribe<O: Observer<Item = Self::Item, Err = Self::Err> + 'a>( self, subscriber: Subscriber<O, LocalSubscription>, ) -> Self::Unsub

Source§

impl<A, B> Observable for ZipOp<A, B>
where A: Observable, B: Observable<Err = A::Err>,

Source§

type Item = (<A as Observable>::Item, <B as Observable>::Item)

Source§

type Err = <A as Observable>::Err

Source§

fn first(self) -> TakeOp<Self>

emit only the first item emitted by an Observable
Source§

fn first_or(self, default: Self::Item) -> DefaultIfEmptyOp<TakeOp<Self>>

emit only the first item emitted by an Observable
Source§

fn last_or( self, default: Self::Item, ) -> DefaultIfEmptyOp<LastOp<Self, Self::Item>>

Emit only the last final item emitted by a source observable or a default item given. Read more
Source§

fn element_at(self, nth: u32) -> TakeOp<SkipOp<Self>>

Emit only item n (0-indexed) emitted by an Observable
Source§

fn ignore_elements(self) -> FilterOp<Self, fn(&Self::Item) -> bool>

Do not emit any items from an Observable but mirror its termination notification
Source§

fn all<F>( self, pred: F, ) -> DefaultIfEmptyOp<TakeOp<FilterOp<MapOp<Self, F>, fn(&bool) -> bool>>>
where F: Fn(Self::Item) -> bool,

Determine whether all items emitted by an Observable meet some criteria
Source§

fn contains(self, target: Self::Item) -> ContainsOp<Self, Self::Item>

Determine whether an Observable emits a particular item or not
Source§

fn last(self) -> LastOp<Self, Self::Item>

Emits only last final item emitted by a source observable. Read more
Source§

fn finalize<F>(self, f: F) -> FinalizeOp<Self, F>
where F: FnMut(),

Call a function when observable completes, errors or is unsubscribed from.
Source§

fn flatten<Inner, A>(self) -> FlattenOp<Self, Inner>
where Inner: Observable<Item = A, Err = Self::Err>,

Creates an Observable that combines all the emissions from Observables that get emitted from an Observable. Read more
Source§

fn flat_map<Inner, B, F>(self, f: F) -> FlatMapOp<Self, Inner, F>
where Inner: Observable<Item = B, Err = Self::Err>, F: Fn(Self::Item) -> Inner,

Applies given function to each item emitted by this Observable, where that function returns an Observable that itself emits items. It then merges the emissions of these resulting Observables, emitting these merged results as its own sequence.
Source§

fn group_by<D, Item, Key>(self, discr: D) -> GroupByOp<Self, D>
where D: FnMut(&Item) -> Key,

Groups items emited by the source Observable into Observables. Each emited Observable emits items matching the key returned by the discriminator function. Read more
Source§

fn map<B, F>(self, f: F) -> MapOp<Self, F>
where F: Fn(Self::Item) -> B,

Creates a new stream which calls a closure on each element and uses its return as the value.
Source§

fn map_to<B>(self, value: B) -> MapToOp<Self, B>

Maps emissions to a constant value.
Source§

fn merge<S>(self, o: S) -> MergeOp<Self, S>
where S: Observable<Item = Self::Item, Err = Self::Err>,

combine two Observables into one by merging their emissions Read more
Source§

fn merge_all(self, concurrent: usize) -> MergeAllOp<Self>

Converts a higher-order Observable into a first-order Observable which concurrently delivers all values that are emitted on the inner Observables. Read more
Source§

fn filter<F>(self, filter: F) -> FilterOp<Self, F>
where F: Fn(&Self::Item) -> bool,

Emit only those items from an Observable that pass a predicate test Read more
Source§

fn filter_map<F, SourceItem, Item>(self, f: F) -> FilterMapOp<Self, F>
where F: FnMut(SourceItem) -> Option<Item>,

The closure must return an Option. filter_map creates an iterator which calls this closure on each element. If the closure returns Some(element), then that element is returned. If the closure returns None, it will try again, and call the closure on the next element, seeing if it will return Some. Read more
Source§

fn box_it<O: IntoBox<Self>>(self) -> BoxOp<O>
where BoxOp<O>: Observable<Item = Self::Item, Err = Self::Err>,

box an observable to a safety object and convert it to a simple type BoxOp, which only care Item and Err Observable emitted. Read more
Source§

fn skip(self, count: u32) -> SkipOp<Self>

Ignore the first count values emitted by the source Observable. Read more
Source§

fn skip_while<F>(self, callback: F) -> SkipWhileOp<Self, F>
where F: FnMut(&Self::Item) -> bool,

Ignore values while result of a callback is true. Read more
Source§

fn skip_last(self, count: usize) -> SkipLastOp<Self>

Ignore the last count values emitted by the source Observable. Read more
Source§

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

Emits only the first count values emitted by the source Observable. Read more
Source§

fn take_until<T>(self, notifier: T) -> TakeUntilOp<Self, T>

Emits the values emitted by the source Observable until a notifier Observable emits a value. Read more
Source§

fn take_while<F>(self, callback: F) -> TakeWhileOp<Self, F>
where F: FnMut(&Self::Item) -> bool,

Emits values while result of an callback is true. Read more
Source§

fn take_last(self, count: usize) -> TakeLastOp<Self>

Emits only the last count values emitted by the source Observable. Read more
Source§

fn sample<O>(self, sampling: O) -> SampleOp<Self, O>
where O: Observable,

Emits item it has most recently emitted since the previous sampling Read more
Source§

fn scan_initial<OutputItem, BinaryOp>( self, initial_value: OutputItem, binary_op: BinaryOp, ) -> ScanOp<Self, BinaryOp, OutputItem>
where BinaryOp: Fn(OutputItem, Self::Item) -> OutputItem, OutputItem: Clone,

The Scan operator applies a function to the first item emitted by the source observable and then emits the result of that function as its own first emission. It also feeds the result of the function back into the function along with the second item emitted by the source observable in order to generate its second emission. It continues to feed back its own subsequent emissions along with the subsequent emissions from the source Observable in order to create the rest of its sequence. Read more
Source§

fn scan<OutputItem, BinaryOp>( self, binary_op: BinaryOp, ) -> ScanOp<Self, BinaryOp, OutputItem>
where BinaryOp: Fn(OutputItem, Self::Item) -> OutputItem, OutputItem: Default + Clone,

Works like scan_initial but starts with a value defined by a Default trait for the first argument binary_op operator operates on. Read more
Source§

fn reduce_initial<OutputItem, BinaryOp>( self, initial: OutputItem, binary_op: BinaryOp, ) -> ReduceOp<Self, BinaryOp, OutputItem>
where BinaryOp: Fn(OutputItem, Self::Item) -> OutputItem, OutputItem: Clone,

Apply a function to each item emitted by an observable, sequentially, and emit the final value, after source observable completes. Read more
Source§

fn reduce<OutputItem, BinaryOp>( self, binary_op: BinaryOp, ) -> DefaultIfEmptyOp<LastOp<ScanOp<Self, BinaryOp, OutputItem>, OutputItem>>
where BinaryOp: Fn(OutputItem, Self::Item) -> OutputItem, OutputItem: Default + Clone,

Works like reduce_initial but starts with a value defined by a Default trait for the first argument f operator operates on. Read more
Source§

fn max(self) -> MinMaxOp<Self, Self::Item>
where Self::Item: Clone + Send + PartialOrd<Self::Item>,

Emits the item from the source observable that had the maximum value. Read more
Source§

fn min(self) -> MinMaxOp<Self, Self::Item>
where Self::Item: Clone + Send + PartialOrd<Self::Item>,

Emits the item from the source observable that had the minimum value. Read more
Source§

fn sum(self) -> SumOp<Self, Self::Item>
where Self::Item: Clone + Default + Add<Self::Item, Output = Self::Item>,

Calculates the sum of numbers emitted by an source observable and emits this sum when source completes. Read more
Source§

fn count(self) -> CountOp<Self, Self::Item>

Emits the number of items emitted by a source observable when this source completes. Read more
Source§

fn average(self) -> AverageOp<Self, Self::Item>
where Self::Item: Clone + Send + Default + Add<Self::Item, Output = Self::Item> + Mul<f64, Output = Self::Item>,

Calculates the sum of numbers emitted by an source observable and emits this sum when source completes. Read more
Source§

fn publish<Subject: Default>(self) -> ConnectableObservable<Self, Subject>

Returns a ConnectableObservable. A ConnectableObservable Observable resembles an ordinary Observable, except that it does not begin emitting items when it is subscribed to, but only when the Connect operator is applied to it. In this way you can wait for all intended observers to subscribe to the Observable before the Observable begins emitting items.
Source§

fn share<Subject, Inner>( self, ) -> RefCount<Inner, ConnectableObservable<Self, Subject>>
where Inner: RefCountCreator<Connectable = ConnectableObservable<Self, Subject>>, Subject: Default, Self: Clone,

Returns a new Observable that multicast (shares) the original Observable. As long as there is at least one Subscriber this Observable will be subscribed and emitting data. When all subscribers have unsubscribed it will unsubscribe from the source Observable. Because the Observable is multicasting it makes the stream hot. This is an alias for publish().ref_count()
Source§

fn delay<SD>(self, dur: Duration, scheduler: SD) -> DelayOp<Self, SD>

Delays the emission of items from the source Observable by a given timeout or until a given Instant.
Source§

fn delay_at<SD>(self, at: Instant, scheduler: SD) -> DelayOp<Self, SD>

Source§

fn subscribe_on<SD>(self, scheduler: SD) -> SubscribeOnOP<Self, SD>

Specify the Scheduler on which an Observable will operate Read more
Source§

fn observe_on<SD>(self, scheduler: SD) -> ObserveOnOp<Self, SD>

Re-emits all notifications from source Observable with specified scheduler. Read more
Source§

fn debounce<SD>(self, duration: Duration, scheduler: SD) -> DebounceOp<Self, SD>

Emits a value from the source Observable only after a particular time span has passed without another source emission.
Source§

fn throttle_time<SD>( self, duration: Duration, edge: ThrottleEdge, scheduler: SD, ) -> ThrottleTimeOp<Self, SD>

Emits a value from the source Observable, then ignores subsequent source values for duration milliseconds, then repeats this process. Read more
Source§

fn distinct(self) -> DistinctOp<Self>

Returns an Observable that emits all items emitted by the source Observable that are distinct by comparison from previous items.
Source§

fn zip<U>(self, other: U) -> ZipOp<Self, U>
where U: Observable,

‘Zips up’ two observable into a single observable of pairs. Read more
Source§

fn default_if_empty(self, default_value: Self::Item) -> DefaultIfEmptyOp<Self>

Emits default value if Observable completed with empty result Read more
Source§

fn buffer_with_count(self, count: usize) -> BufferWithCountOp<Self>

Buffers emitted values of type T in a Vec and emits that Vec as soon as the buffer’s size equals the given count. On complete, if the buffer is not empty, it will be emitted. On error, the buffer will be discarded. Read more
Source§

fn buffer_with_time<S>( self, time: Duration, scheduler: S, ) -> BufferWithTimeOp<Self, S>

Buffers emitted values of type T in a Vec and emits that Vec periodically. Read more
Source§

fn buffer_with_count_and_time<S>( self, count: usize, time: Duration, scheduler: S, ) -> BufferWithCountOrTimerOp<Self, S>

Buffers emitted values of type T in a Vec and emits that Vec either if the buffer’s size equals count, or periodically. This operator combines the functionality of buffer_with_count and buffer_with_time. Read more
Source§

impl<A, B> SharedObservable for ZipOp<A, B>
where A: SharedObservable, B: SharedObservable<Err = A::Err>, A::Item: Send + Sync + 'static, B::Item: Send + Sync + 'static, A::Unsub: Send + Sync, B::Unsub: Send + Sync,

Source§

type Unsub = SharedSubscription

Source§

fn actual_subscribe<O: Observer<Item = Self::Item, Err = Self::Err> + Sync + Send + 'static>( self, subscriber: Subscriber<O, SharedSubscription>, ) -> Self::Unsub

Source§

fn into_shared(self) -> Shared<Self>
where Self: Sized,

Convert to a thread-safe mode.

Auto Trait Implementations§

§

impl<A, B> Freeze for ZipOp<A, B>
where A: Freeze, B: Freeze,

§

impl<A, B> RefUnwindSafe for ZipOp<A, B>

§

impl<A, B> Send for ZipOp<A, B>
where A: Send, B: Send,

§

impl<A, B> Sync for ZipOp<A, B>
where A: Sync, B: Sync,

§

impl<A, B> Unpin for ZipOp<A, B>
where A: Unpin, B: Unpin,

§

impl<A, B> UnwindSafe for ZipOp<A, B>
where A: UnwindSafe, B: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<'a, T> BoxClone<'a> for T
where T: BoxObservable<'a> + Clone + 'a,

Source§

fn box_clone( &self, ) -> Box<dyn BoxClone<'a, Err = <T as BoxObservable<'a>>::Err, Item = <T as BoxObservable<'a>>::Item> + 'a>

Source§

impl<'a, T> BoxObservable<'a> for T
where T: LocalObservable<'a> + 'a,

Source§

type Item = <T as Observable>::Item

Source§

type Err = <T as Observable>::Err

Source§

fn box_subscribe( self: Box<T>, subscriber: Subscriber<Box<dyn Observer<Err = <T as BoxObservable<'a>>::Err, Item = <T as BoxObservable<'a>>::Item> + 'a>, LocalSubscription>, ) -> Box<dyn SubscriptionLike>

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> SharedBoxClone for T
where T: SharedBoxObservable + Clone + 'static,

Source§

fn box_clone( &self, ) -> Box<dyn SharedBoxClone<Item = <T as SharedBoxObservable>::Item, Err = <T as SharedBoxObservable>::Err>>

Source§

impl<'a, S, N, E, C> SubscribeAll<'a, N, E, C> for S
where S: LocalObservable<'a>, N: FnMut(<S as Observable>::Item) + 'a, E: FnMut(<S as Observable>::Err) + 'a, <S as Observable>::Err: 'a, <S as Observable>::Item: 'a, C: FnMut() + 'a,

Source§

type Unsub = <S as LocalObservable<'a>>::Unsub

A type implementing SubscriptionLike
Source§

fn subscribe_all( self, next: N, error: E, complete: C, ) -> SubscriptionWrapper<<S as SubscribeAll<'a, N, E, C>>::Unsub>

Invokes an execution of an Observable and registers Observer handlers for notifications it will emit. Read more
Source§

impl<'a, S, N, C> SubscribeComplete<'a, N, C> for S
where S: LocalObservable<'a, Err = ()>, C: FnMut() + 'a, N: FnMut(<S as Observable>::Item) + 'a, <S as Observable>::Item: 'a,

Source§

type Unsub = <S as LocalObservable<'a>>::Unsub

A type implementing SubscriptionLike
Source§

fn subscribe_complete( self, next: N, complete: C, ) -> SubscriptionWrapper<<S as SubscribeComplete<'a, N, C>>::Unsub>
where <S as Observable>::Item: 'a,

Invokes an execution of an Observable and registers Observer handlers for notifications it will emit.
Source§

impl<'a, S, N, E> SubscribeErr<'a, N, E> for S
where S: LocalObservable<'a>, N: FnMut(<S as Observable>::Item) + 'a, E: FnMut(<S as Observable>::Err) + 'a, <S as Observable>::Err: 'a, <S as Observable>::Item: 'a,

Source§

type Unsub = <S as LocalObservable<'a>>::Unsub

A type implementing SubscriptionLike
Source§

fn subscribe_err( self, next: N, error: E, ) -> SubscriptionWrapper<<S as SubscribeErr<'a, N, E>>::Unsub>

Invokes an execution of an Observable and registers Observer handlers for notifications it will emit. Read more
Source§

impl<'a, S, N> SubscribeNext<'a, N> for S
where S: LocalObservable<'a, Err = ()>, N: FnMut(<S as Observable>::Item) + 'a, <S as Observable>::Item: 'a,

Source§

type Unsub = <S as LocalObservable<'a>>::Unsub

A type implementing SubscriptionLike
Source§

fn subscribe( self, next: N, ) -> SubscriptionWrapper<<S as SubscribeNext<'a, N>>::Unsub>

Invokes an execution of an Observable and registers Observer handlers for notifications it will emit.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more