953 lines
53 KiB
Swift
953 lines
53 KiB
Swift
// This file contains parts of Apple's Combine that remain unimplemented in OpenCombine
|
||
// Please remove the corresponding piece from this file if you implement something,
|
||
// and complement this file as features are added in Apple's Combine
|
||
|
||
extension Publishers {
|
||
|
||
/// A publisher that receives and combines the latest elements from two publishers.
|
||
public struct CombineLatest<A, B> : Publisher where A : Publisher, B : Publisher, A.Failure == B.Failure {
|
||
|
||
/// The kind of values published by this publisher.
|
||
public typealias Output = (A.Output, B.Output)
|
||
|
||
/// The kind of errors this publisher might publish.
|
||
///
|
||
/// Use `Never` if this `Publisher` does not publish errors.
|
||
public typealias Failure = A.Failure
|
||
|
||
public let a: A
|
||
|
||
public let b: B
|
||
|
||
public init(_ a: A, _ b: B)
|
||
|
||
/// This function is called to attach the specified `Subscriber` to this `Publisher` by `subscribe(_:)`
|
||
///
|
||
/// - SeeAlso: `subscribe(_:)`
|
||
/// - Parameters:
|
||
/// - subscriber: The subscriber to attach to this `Publisher`.
|
||
/// once attached it can begin to receive values.
|
||
public func receive<S>(subscriber: S) where S : Subscriber, B.Failure == S.Failure, S.Input == (A.Output, B.Output)
|
||
}
|
||
|
||
/// A publisher that receives and combines the latest elements from three publishers.
|
||
public struct CombineLatest3<A, B, C> : Publisher where A : Publisher, B : Publisher, C : Publisher, A.Failure == B.Failure, B.Failure == C.Failure {
|
||
|
||
/// The kind of values published by this publisher.
|
||
public typealias Output = (A.Output, B.Output, C.Output)
|
||
|
||
/// The kind of errors this publisher might publish.
|
||
///
|
||
/// Use `Never` if this `Publisher` does not publish errors.
|
||
public typealias Failure = A.Failure
|
||
|
||
public let a: A
|
||
|
||
public let b: B
|
||
|
||
public let c: C
|
||
|
||
public init(_ a: A, _ b: B, _ c: C)
|
||
|
||
/// This function is called to attach the specified `Subscriber` to this `Publisher` by `subscribe(_:)`
|
||
///
|
||
/// - SeeAlso: `subscribe(_:)`
|
||
/// - Parameters:
|
||
/// - subscriber: The subscriber to attach to this `Publisher`.
|
||
/// once attached it can begin to receive values.
|
||
public func receive<S>(subscriber: S) where S : Subscriber, C.Failure == S.Failure, S.Input == (A.Output, B.Output, C.Output)
|
||
}
|
||
|
||
/// A publisher that receives and combines the latest elements from four publishers.
|
||
public struct CombineLatest4<A, B, C, D> : Publisher where A : Publisher, B : Publisher, C : Publisher, D : Publisher, A.Failure == B.Failure, B.Failure == C.Failure, C.Failure == D.Failure {
|
||
|
||
/// The kind of values published by this publisher.
|
||
public typealias Output = (A.Output, B.Output, C.Output, D.Output)
|
||
|
||
/// The kind of errors this publisher might publish.
|
||
///
|
||
/// Use `Never` if this `Publisher` does not publish errors.
|
||
public typealias Failure = A.Failure
|
||
|
||
public let a: A
|
||
|
||
public let b: B
|
||
|
||
public let c: C
|
||
|
||
public let d: D
|
||
|
||
public init(_ a: A, _ b: B, _ c: C, _ d: D)
|
||
|
||
/// This function is called to attach the specified `Subscriber` to this `Publisher` by `subscribe(_:)`
|
||
///
|
||
/// - SeeAlso: `subscribe(_:)`
|
||
/// - Parameters:
|
||
/// - subscriber: The subscriber to attach to this `Publisher`.
|
||
/// once attached it can begin to receive values.
|
||
public func receive<S>(subscriber: S) where S : Subscriber, D.Failure == S.Failure, S.Input == (A.Output, B.Output, C.Output, D.Output)
|
||
}
|
||
}
|
||
|
||
extension Publisher {
|
||
|
||
/// Subscribes to an additional publisher and publishes a tuple upon receiving output from either publisher.
|
||
///
|
||
/// The combined publisher passes through any requests to *all* upstream publishers. However, it still obeys the demand-fulfilling rule of only sending the request amount downstream. If the demand isn’t `.unlimited`, it drops values from upstream publishers. It implements this by using a buffer size of 1 for each upstream, and holds the most recent value in each buffer.
|
||
/// All upstream publishers need to finish for this publisher to finsh. If an upstream publisher never publishes a value, this publisher never finishes.
|
||
/// If any of the combined publishers terminates with a failure, this publisher also fails.
|
||
/// - Parameters:
|
||
/// - other: Another publisher to combine with this one.
|
||
/// - Returns: A publisher that receives and combines elements from this and another publisher.
|
||
public func combineLatest<P>(_ other: P) -> Publishers.CombineLatest<Self, P> where P : Publisher, Self.Failure == P.Failure
|
||
|
||
/// Subscribes to an additional publisher and invokes a closure upon receiving output from either publisher.
|
||
///
|
||
/// The combined publisher passes through any requests to *all* upstream publishers. However, it still obeys the demand-fulfilling rule of only sending the request amount downstream. If the demand isn’t `.unlimited`, it drops values from upstream publishers. It implements this by using a buffer size of 1 for each upstream, and holds the most recent value in each buffer.
|
||
/// All upstream publishers need to finish for this publisher to finsh. If an upstream publisher never publishes a value, this publisher never finishes.
|
||
/// If any of the combined publishers terminates with a failure, this publisher also fails.
|
||
/// - Parameters:
|
||
/// - other: Another publisher to combine with this one.
|
||
/// - transform: A closure that receives the most recent value from each publisher and returns a new value to publish.
|
||
/// - Returns: A publisher that receives and combines elements from this and another publisher.
|
||
public func combineLatest<P, T>(_ other: P, _ transform: @escaping (Self.Output, P.Output) -> T) -> Publishers.Map<Publishers.CombineLatest<Self, P>, T> where P : Publisher, Self.Failure == P.Failure
|
||
|
||
/// Subscribes to two additional publishers and publishes a tuple upon receiving output from any of the publishers.
|
||
///
|
||
/// The combined publisher passes through any requests to *all* upstream publishers. However, it still obeys the demand-fulfilling rule of only sending the request amount downstream. If the demand isn’t `.unlimited`, it drops values from upstream publishers. It implements this by using a buffer size of 1 for each upstream, and holds the most recent value in each buffer.
|
||
/// All upstream publishers need to finish for this publisher to finish. If an upstream publisher never publishes a value, this publisher never finishes.
|
||
/// If any of the combined publishers terminates with a failure, this publisher also fails.
|
||
/// - Parameters:
|
||
/// - publisher1: A second publisher to combine with this one.
|
||
/// - publisher2: A third publisher to combine with this one.
|
||
/// - Returns: A publisher that receives and combines elements from this publisher and two other publishers.
|
||
public func combineLatest<P, Q>(_ publisher1: P, _ publisher2: Q) -> Publishers.CombineLatest3<Self, P, Q> where P : Publisher, Q : Publisher, Self.Failure == P.Failure, P.Failure == Q.Failure
|
||
|
||
/// Subscribes to two additional publishers and invokes a closure upon receiving output from any of the publishers.
|
||
///
|
||
/// The combined publisher passes through any requests to *all* upstream publishers. However, it still obeys the demand-fulfilling rule of only sending the request amount downstream. If the demand isn’t `.unlimited`, it drops values from upstream publishers. It implements this by using a buffer size of 1 for each upstream, and holds the most recent value in each buffer.
|
||
/// All upstream publishers need to finish for this publisher to finish. If an upstream publisher never publishes a value, this publisher never finishes.
|
||
/// If any of the combined publishers terminates with a failure, this publisher also fails.
|
||
/// - Parameters:
|
||
/// - publisher1: A second publisher to combine with this one.
|
||
/// - publisher2: A third publisher to combine with this one.
|
||
/// - transform: A closure that receives the most recent value from each publisher and returns a new value to publish.
|
||
/// - Returns: A publisher that receives and combines elements from this publisher and two other publishers.
|
||
public func combineLatest<P, Q, T>(_ publisher1: P, _ publisher2: Q, _ transform: @escaping (Self.Output, P.Output, Q.Output) -> T) -> Publishers.Map<Publishers.CombineLatest3<Self, P, Q>, T> where P : Publisher, Q : Publisher, Self.Failure == P.Failure, P.Failure == Q.Failure
|
||
|
||
/// Subscribes to three additional publishers and publishes a tuple upon receiving output from any of the publishers.
|
||
///
|
||
/// The combined publisher passes through any requests to *all* upstream publishers. However, it still obeys the demand-fulfilling rule of only sending the request amount downstream. If the demand isn’t `.unlimited`, it drops values from upstream publishers. It implements this by using a buffer size of 1 for each upstream, and holds the most recent value in each buffer.
|
||
/// All upstream publishers need to finish for this publisher to finish. If an upstream publisher never publishes a value, this publisher never finishes.
|
||
/// If any of the combined publishers terminates with a failure, this publisher also fails.
|
||
/// - Parameters:
|
||
/// - publisher1: A second publisher to combine with this one.
|
||
/// - publisher2: A third publisher to combine with this one.
|
||
/// - publisher3: A fourth publisher to combine with this one.
|
||
/// - Returns: A publisher that receives and combines elements from this publisher and three other publishers.
|
||
public func combineLatest<P, Q, R>(_ publisher1: P, _ publisher2: Q, _ publisher3: R) -> Publishers.CombineLatest4<Self, P, Q, R> where P : Publisher, Q : Publisher, R : Publisher, Self.Failure == P.Failure, P.Failure == Q.Failure, Q.Failure == R.Failure
|
||
|
||
/// Subscribes to three additional publishers and invokes a closure upon receiving output from any of the publishers.
|
||
///
|
||
/// The combined publisher passes through any requests to *all* upstream publishers. However, it still obeys the demand-fulfilling rule of only sending the request amount downstream. If the demand isn’t `.unlimited`, it drops values from upstream publishers. It implements this by using a buffer size of 1 for each upstream, and holds the most recent value in each buffer.
|
||
/// All upstream publishers need to finish for this publisher to finish. If an upstream publisher never publishes a value, this publisher never finishes.
|
||
/// If any of the combined publishers terminates with a failure, this publisher also fails.
|
||
/// - Parameters:
|
||
/// - publisher1: A second publisher to combine with this one.
|
||
/// - publisher2: A third publisher to combine with this one.
|
||
/// - publisher3: A fourth publisher to combine with this one.
|
||
/// - transform: A closure that receives the most recent value from each publisher and returns a new value to publish.
|
||
/// - Returns: A publisher that receives and combines elements from this publisher and three other publishers.
|
||
public func combineLatest<P, Q, R, T>(_ publisher1: P, _ publisher2: Q, _ publisher3: R, _ transform: @escaping (Self.Output, P.Output, Q.Output, R.Output) -> T) -> Publishers.Map<Publishers.CombineLatest4<Self, P, Q, R>, T> where P : Publisher, Q : Publisher, R : Publisher, Self.Failure == P.Failure, P.Failure == Q.Failure, Q.Failure == R.Failure
|
||
}
|
||
|
||
extension Publishers {
|
||
|
||
/// A strategy for collecting received elements.
|
||
public enum TimeGroupingStrategy<Context> where Context : Scheduler {
|
||
|
||
/// A grouping that collects and periodically publishes items.
|
||
case byTime(Context, Context.SchedulerTimeType.Stride)
|
||
|
||
/// A grouping that collects and publishes items periodically or when a buffer reaches a maximum size.
|
||
case byTimeOrCount(Context, Context.SchedulerTimeType.Stride, Int)
|
||
}
|
||
|
||
/// A publisher that buffers and periodically publishes its items.
|
||
public struct CollectByTime<Upstream, Context> : Publisher where Upstream : Publisher, Context : Scheduler {
|
||
|
||
/// The kind of values published by this publisher.
|
||
public typealias Output = [Upstream.Output]
|
||
|
||
/// The kind of errors this publisher might publish.
|
||
///
|
||
/// Use `Never` if this `Publisher` does not publish errors.
|
||
public typealias Failure = Upstream.Failure
|
||
|
||
/// The publisher that this publisher receives elements from.
|
||
public let upstream: Upstream
|
||
|
||
/// The strategy with which to collect and publish elements.
|
||
public let strategy: Publishers.TimeGroupingStrategy<Context>
|
||
|
||
/// `Scheduler` options to use for the strategy.
|
||
public let options: Context.SchedulerOptions?
|
||
|
||
public init(upstream: Upstream, strategy: Publishers.TimeGroupingStrategy<Context>, options: Context.SchedulerOptions?)
|
||
|
||
/// This function is called to attach the specified `Subscriber` to this `Publisher` by `subscribe(_:)`
|
||
///
|
||
/// - SeeAlso: `subscribe(_:)`
|
||
/// - Parameters:
|
||
/// - subscriber: The subscriber to attach to this `Publisher`.
|
||
/// once attached it can begin to receive values.
|
||
public func receive<S>(subscriber: S) where S : Subscriber, Upstream.Failure == S.Failure, S.Input == [Upstream.Output]
|
||
}
|
||
}
|
||
|
||
extension Publisher {
|
||
|
||
/// Collects elements by a given time-grouping strategy, and emits a single array of
|
||
/// the collection.
|
||
///
|
||
/// Use `collect(_:options:)` to emit arrays of elements on a schedule specified by
|
||
/// a `Scheduler` and `Stride` that you provide. At the end of each scheduled
|
||
/// interval, the publisher sends an array that contains the items it collected.
|
||
/// If the upstream publisher finishes before filling the buffer, the publisher sends
|
||
/// an array that contains items it received. This may be fewer than the number of
|
||
/// elements specified in the requested `Stride`.
|
||
///
|
||
/// If the upstream publisher fails with an error, this publisher forwards the error
|
||
/// to the downstream receiver instead of sending its output.
|
||
///
|
||
/// The example above collects timestamps generated on a one-second `Timer` in groups
|
||
/// (`Stride`) of five.
|
||
///
|
||
/// let sub = Timer.publish(every: 1, on: .main, in: .default)
|
||
/// .autoconnect()
|
||
/// .collect(.byTime(RunLoop.main, .seconds(5)))
|
||
/// .sink { print("\($0)", terminator: "\n\n") }
|
||
///
|
||
/// // Prints: "[2020-01-24 00:54:46 +0000, 2020-01-24 00:54:47 +0000,
|
||
/// // 2020-01-24 00:54:48 +0000, 2020-01-24 00:54:49 +0000,
|
||
/// // 2020-01-24 00:54:50 +0000]"
|
||
///
|
||
/// > Note: When this publisher receives a request for `.max(n)` elements, it requests
|
||
/// `.max(count * n)` from the upstream publisher.
|
||
///
|
||
/// - Parameters:
|
||
/// - strategy: The timing group strategy used by the operator to collect and
|
||
/// publish elements.
|
||
/// - options: ``Scheduler`` options to use for the strategy.
|
||
/// - Returns: A publisher that collects elements by a given strategy, and emits
|
||
/// a single array of the collection.
|
||
public func collect<S>(_ strategy: Publishers.TimeGroupingStrategy<S>, options: S.SchedulerOptions? = nil) -> Publishers.CollectByTime<Self, S> where S : Scheduler
|
||
}
|
||
|
||
extension Publishers {
|
||
|
||
/// A publisher created by applying the merge function to two upstream publishers.
|
||
public struct Merge<A, B> : Publisher where A : Publisher, B : Publisher, A.Failure == B.Failure, A.Output == B.Output {
|
||
|
||
/// The kind of values published by this publisher.
|
||
public typealias Output = A.Output
|
||
|
||
/// The kind of errors this publisher might publish.
|
||
///
|
||
/// Use `Never` if this `Publisher` does not publish errors.
|
||
public typealias Failure = A.Failure
|
||
|
||
public let a: A
|
||
|
||
public let b: B
|
||
|
||
public init(_ a: A, _ b: B)
|
||
|
||
/// This function is called to attach the specified `Subscriber` to this `Publisher` by `subscribe(_:)`
|
||
///
|
||
/// - SeeAlso: `subscribe(_:)`
|
||
/// - Parameters:
|
||
/// - subscriber: The subscriber to attach to this `Publisher`.
|
||
/// once attached it can begin to receive values.
|
||
public func receive<S>(subscriber: S) where S : Subscriber, B.Failure == S.Failure, B.Output == S.Input
|
||
|
||
public func merge<P>(with other: P) -> Publishers.Merge3<A, B, P> where P : Publisher, B.Failure == P.Failure, B.Output == P.Output
|
||
|
||
public func merge<Z, Y>(with z: Z, _ y: Y) -> Publishers.Merge4<A, B, Z, Y> where Z : Publisher, Y : Publisher, B.Failure == Z.Failure, B.Output == Z.Output, Z.Failure == Y.Failure, Z.Output == Y.Output
|
||
|
||
public func merge<Z, Y, X>(with z: Z, _ y: Y, _ x: X) -> Publishers.Merge5<A, B, Z, Y, X> where Z : Publisher, Y : Publisher, X : Publisher, B.Failure == Z.Failure, B.Output == Z.Output, Z.Failure == Y.Failure, Z.Output == Y.Output, Y.Failure == X.Failure, Y.Output == X.Output
|
||
|
||
public func merge<Z, Y, X, W>(with z: Z, _ y: Y, _ x: X, _ w: W) -> Publishers.Merge6<A, B, Z, Y, X, W> where Z : Publisher, Y : Publisher, X : Publisher, W : Publisher, B.Failure == Z.Failure, B.Output == Z.Output, Z.Failure == Y.Failure, Z.Output == Y.Output, Y.Failure == X.Failure, Y.Output == X.Output, X.Failure == W.Failure, X.Output == W.Output
|
||
|
||
public func merge<Z, Y, X, W, V>(with z: Z, _ y: Y, _ x: X, _ w: W, _ v: V) -> Publishers.Merge7<A, B, Z, Y, X, W, V> where Z : Publisher, Y : Publisher, X : Publisher, W : Publisher, V : Publisher, B.Failure == Z.Failure, B.Output == Z.Output, Z.Failure == Y.Failure, Z.Output == Y.Output, Y.Failure == X.Failure, Y.Output == X.Output, X.Failure == W.Failure, X.Output == W.Output, W.Failure == V.Failure, W.Output == V.Output
|
||
|
||
public func merge<Z, Y, X, W, V, U>(with z: Z, _ y: Y, _ x: X, _ w: W, _ v: V, _ u: U) -> Publishers.Merge8<A, B, Z, Y, X, W, V, U> where Z : Publisher, Y : Publisher, X : Publisher, W : Publisher, V : Publisher, U : Publisher, B.Failure == Z.Failure, B.Output == Z.Output, Z.Failure == Y.Failure, Z.Output == Y.Output, Y.Failure == X.Failure, Y.Output == X.Output, X.Failure == W.Failure, X.Output == W.Output, W.Failure == V.Failure, W.Output == V.Output, V.Failure == U.Failure, V.Output == U.Output
|
||
}
|
||
|
||
/// A publisher created by applying the merge function to three upstream publishers.
|
||
public struct Merge3<A, B, C> : Publisher where A : Publisher, B : Publisher, C : Publisher, A.Failure == B.Failure, A.Output == B.Output, B.Failure == C.Failure, B.Output == C.Output {
|
||
|
||
/// The kind of values published by this publisher.
|
||
public typealias Output = A.Output
|
||
|
||
/// The kind of errors this publisher might publish.
|
||
///
|
||
/// Use `Never` if this `Publisher` does not publish errors.
|
||
public typealias Failure = A.Failure
|
||
|
||
public let a: A
|
||
|
||
public let b: B
|
||
|
||
public let c: C
|
||
|
||
public init(_ a: A, _ b: B, _ c: C)
|
||
|
||
/// This function is called to attach the specified `Subscriber` to this `Publisher` by `subscribe(_:)`
|
||
///
|
||
/// - SeeAlso: `subscribe(_:)`
|
||
/// - Parameters:
|
||
/// - subscriber: The subscriber to attach to this `Publisher`.
|
||
/// once attached it can begin to receive values.
|
||
public func receive<S>(subscriber: S) where S : Subscriber, C.Failure == S.Failure, C.Output == S.Input
|
||
|
||
public func merge<P>(with other: P) -> Publishers.Merge4<A, B, C, P> where P : Publisher, C.Failure == P.Failure, C.Output == P.Output
|
||
|
||
public func merge<Z, Y>(with z: Z, _ y: Y) -> Publishers.Merge5<A, B, C, Z, Y> where Z : Publisher, Y : Publisher, C.Failure == Z.Failure, C.Output == Z.Output, Z.Failure == Y.Failure, Z.Output == Y.Output
|
||
|
||
public func merge<Z, Y, X>(with z: Z, _ y: Y, _ x: X) -> Publishers.Merge6<A, B, C, Z, Y, X> where Z : Publisher, Y : Publisher, X : Publisher, C.Failure == Z.Failure, C.Output == Z.Output, Z.Failure == Y.Failure, Z.Output == Y.Output, Y.Failure == X.Failure, Y.Output == X.Output
|
||
|
||
public func merge<Z, Y, X, W>(with z: Z, _ y: Y, _ x: X, _ w: W) -> Publishers.Merge7<A, B, C, Z, Y, X, W> where Z : Publisher, Y : Publisher, X : Publisher, W : Publisher, C.Failure == Z.Failure, C.Output == Z.Output, Z.Failure == Y.Failure, Z.Output == Y.Output, Y.Failure == X.Failure, Y.Output == X.Output, X.Failure == W.Failure, X.Output == W.Output
|
||
|
||
public func merge<Z, Y, X, W, V>(with z: Z, _ y: Y, _ x: X, _ w: W, _ v: V) -> Publishers.Merge8<A, B, C, Z, Y, X, W, V> where Z : Publisher, Y : Publisher, X : Publisher, W : Publisher, V : Publisher, C.Failure == Z.Failure, C.Output == Z.Output, Z.Failure == Y.Failure, Z.Output == Y.Output, Y.Failure == X.Failure, Y.Output == X.Output, X.Failure == W.Failure, X.Output == W.Output, W.Failure == V.Failure, W.Output == V.Output
|
||
}
|
||
|
||
/// A publisher created by applying the merge function to four upstream publishers.
|
||
public struct Merge4<A, B, C, D> : Publisher where A : Publisher, B : Publisher, C : Publisher, D : Publisher, A.Failure == B.Failure, A.Output == B.Output, B.Failure == C.Failure, B.Output == C.Output, C.Failure == D.Failure, C.Output == D.Output {
|
||
|
||
/// The kind of values published by this publisher.
|
||
public typealias Output = A.Output
|
||
|
||
/// The kind of errors this publisher might publish.
|
||
///
|
||
/// Use `Never` if this `Publisher` does not publish errors.
|
||
public typealias Failure = A.Failure
|
||
|
||
public let a: A
|
||
|
||
public let b: B
|
||
|
||
public let c: C
|
||
|
||
public let d: D
|
||
|
||
public init(_ a: A, _ b: B, _ c: C, _ d: D)
|
||
|
||
/// This function is called to attach the specified `Subscriber` to this `Publisher` by `subscribe(_:)`
|
||
///
|
||
/// - SeeAlso: `subscribe(_:)`
|
||
/// - Parameters:
|
||
/// - subscriber: The subscriber to attach to this `Publisher`.
|
||
/// once attached it can begin to receive values.
|
||
public func receive<S>(subscriber: S) where S : Subscriber, D.Failure == S.Failure, D.Output == S.Input
|
||
|
||
public func merge<P>(with other: P) -> Publishers.Merge5<A, B, C, D, P> where P : Publisher, D.Failure == P.Failure, D.Output == P.Output
|
||
|
||
public func merge<Z, Y>(with z: Z, _ y: Y) -> Publishers.Merge6<A, B, C, D, Z, Y> where Z : Publisher, Y : Publisher, D.Failure == Z.Failure, D.Output == Z.Output, Z.Failure == Y.Failure, Z.Output == Y.Output
|
||
|
||
public func merge<Z, Y, X>(with z: Z, _ y: Y, _ x: X) -> Publishers.Merge7<A, B, C, D, Z, Y, X> where Z : Publisher, Y : Publisher, X : Publisher, D.Failure == Z.Failure, D.Output == Z.Output, Z.Failure == Y.Failure, Z.Output == Y.Output, Y.Failure == X.Failure, Y.Output == X.Output
|
||
|
||
public func merge<Z, Y, X, W>(with z: Z, _ y: Y, _ x: X, _ w: W) -> Publishers.Merge8<A, B, C, D, Z, Y, X, W> where Z : Publisher, Y : Publisher, X : Publisher, W : Publisher, D.Failure == Z.Failure, D.Output == Z.Output, Z.Failure == Y.Failure, Z.Output == Y.Output, Y.Failure == X.Failure, Y.Output == X.Output, X.Failure == W.Failure, X.Output == W.Output
|
||
}
|
||
|
||
/// A publisher created by applying the merge function to five upstream publishers.
|
||
public struct Merge5<A, B, C, D, E> : Publisher where A : Publisher, B : Publisher, C : Publisher, D : Publisher, E : Publisher, A.Failure == B.Failure, A.Output == B.Output, B.Failure == C.Failure, B.Output == C.Output, C.Failure == D.Failure, C.Output == D.Output, D.Failure == E.Failure, D.Output == E.Output {
|
||
|
||
/// The kind of values published by this publisher.
|
||
public typealias Output = A.Output
|
||
|
||
/// The kind of errors this publisher might publish.
|
||
///
|
||
/// Use `Never` if this `Publisher` does not publish errors.
|
||
public typealias Failure = A.Failure
|
||
|
||
public let a: A
|
||
|
||
public let b: B
|
||
|
||
public let c: C
|
||
|
||
public let d: D
|
||
|
||
public let e: E
|
||
|
||
public init(_ a: A, _ b: B, _ c: C, _ d: D, _ e: E)
|
||
|
||
/// This function is called to attach the specified `Subscriber` to this `Publisher` by `subscribe(_:)`
|
||
///
|
||
/// - SeeAlso: `subscribe(_:)`
|
||
/// - Parameters:
|
||
/// - subscriber: The subscriber to attach to this `Publisher`.
|
||
/// once attached it can begin to receive values.
|
||
public func receive<S>(subscriber: S) where S : Subscriber, E.Failure == S.Failure, E.Output == S.Input
|
||
|
||
public func merge<P>(with other: P) -> Publishers.Merge6<A, B, C, D, E, P> where P : Publisher, E.Failure == P.Failure, E.Output == P.Output
|
||
|
||
public func merge<Z, Y>(with z: Z, _ y: Y) -> Publishers.Merge7<A, B, C, D, E, Z, Y> where Z : Publisher, Y : Publisher, E.Failure == Z.Failure, E.Output == Z.Output, Z.Failure == Y.Failure, Z.Output == Y.Output
|
||
|
||
public func merge<Z, Y, X>(with z: Z, _ y: Y, _ x: X) -> Publishers.Merge8<A, B, C, D, E, Z, Y, X> where Z : Publisher, Y : Publisher, X : Publisher, E.Failure == Z.Failure, E.Output == Z.Output, Z.Failure == Y.Failure, Z.Output == Y.Output, Y.Failure == X.Failure, Y.Output == X.Output
|
||
}
|
||
|
||
/// A publisher created by applying the merge function to six upstream publishers.
|
||
public struct Merge6<A, B, C, D, E, F> : Publisher where A : Publisher, B : Publisher, C : Publisher, D : Publisher, E : Publisher, F : Publisher, A.Failure == B.Failure, A.Output == B.Output, B.Failure == C.Failure, B.Output == C.Output, C.Failure == D.Failure, C.Output == D.Output, D.Failure == E.Failure, D.Output == E.Output, E.Failure == F.Failure, E.Output == F.Output {
|
||
|
||
/// The kind of values published by this publisher.
|
||
public typealias Output = A.Output
|
||
|
||
/// The kind of errors this publisher might publish.
|
||
///
|
||
/// Use `Never` if this `Publisher` does not publish errors.
|
||
public typealias Failure = A.Failure
|
||
|
||
public let a: A
|
||
|
||
public let b: B
|
||
|
||
public let c: C
|
||
|
||
public let d: D
|
||
|
||
public let e: E
|
||
|
||
public let f: F
|
||
|
||
public init(_ a: A, _ b: B, _ c: C, _ d: D, _ e: E, _ f: F)
|
||
|
||
/// This function is called to attach the specified `Subscriber` to this `Publisher` by `subscribe(_:)`
|
||
///
|
||
/// - SeeAlso: `subscribe(_:)`
|
||
/// - Parameters:
|
||
/// - subscriber: The subscriber to attach to this `Publisher`.
|
||
/// once attached it can begin to receive values.
|
||
public func receive<S>(subscriber: S) where S : Subscriber, F.Failure == S.Failure, F.Output == S.Input
|
||
|
||
public func merge<P>(with other: P) -> Publishers.Merge7<A, B, C, D, E, F, P> where P : Publisher, F.Failure == P.Failure, F.Output == P.Output
|
||
|
||
public func merge<Z, Y>(with z: Z, _ y: Y) -> Publishers.Merge8<A, B, C, D, E, F, Z, Y> where Z : Publisher, Y : Publisher, F.Failure == Z.Failure, F.Output == Z.Output, Z.Failure == Y.Failure, Z.Output == Y.Output
|
||
}
|
||
|
||
/// A publisher created by applying the merge function to seven upstream publishers.
|
||
public struct Merge7<A, B, C, D, E, F, G> : Publisher where A : Publisher, B : Publisher, C : Publisher, D : Publisher, E : Publisher, F : Publisher, G : Publisher, A.Failure == B.Failure, A.Output == B.Output, B.Failure == C.Failure, B.Output == C.Output, C.Failure == D.Failure, C.Output == D.Output, D.Failure == E.Failure, D.Output == E.Output, E.Failure == F.Failure, E.Output == F.Output, F.Failure == G.Failure, F.Output == G.Output {
|
||
|
||
/// The kind of values published by this publisher.
|
||
public typealias Output = A.Output
|
||
|
||
/// The kind of errors this publisher might publish.
|
||
///
|
||
/// Use `Never` if this `Publisher` does not publish errors.
|
||
public typealias Failure = A.Failure
|
||
|
||
public let a: A
|
||
|
||
public let b: B
|
||
|
||
public let c: C
|
||
|
||
public let d: D
|
||
|
||
public let e: E
|
||
|
||
public let f: F
|
||
|
||
public let g: G
|
||
|
||
public init(_ a: A, _ b: B, _ c: C, _ d: D, _ e: E, _ f: F, _ g: G)
|
||
|
||
/// This function is called to attach the specified `Subscriber` to this `Publisher` by `subscribe(_:)`
|
||
///
|
||
/// - SeeAlso: `subscribe(_:)`
|
||
/// - Parameters:
|
||
/// - subscriber: The subscriber to attach to this `Publisher`.
|
||
/// once attached it can begin to receive values.
|
||
public func receive<S>(subscriber: S) where S : Subscriber, G.Failure == S.Failure, G.Output == S.Input
|
||
|
||
public func merge<P>(with other: P) -> Publishers.Merge8<A, B, C, D, E, F, G, P> where P : Publisher, G.Failure == P.Failure, G.Output == P.Output
|
||
}
|
||
|
||
/// A publisher created by applying the merge function to eight upstream publishers.
|
||
public struct Merge8<A, B, C, D, E, F, G, H> : Publisher where A : Publisher, B : Publisher, C : Publisher, D : Publisher, E : Publisher, F : Publisher, G : Publisher, H : Publisher, A.Failure == B.Failure, A.Output == B.Output, B.Failure == C.Failure, B.Output == C.Output, C.Failure == D.Failure, C.Output == D.Output, D.Failure == E.Failure, D.Output == E.Output, E.Failure == F.Failure, E.Output == F.Output, F.Failure == G.Failure, F.Output == G.Output, G.Failure == H.Failure, G.Output == H.Output {
|
||
|
||
/// The kind of values published by this publisher.
|
||
public typealias Output = A.Output
|
||
|
||
/// The kind of errors this publisher might publish.
|
||
///
|
||
/// Use `Never` if this `Publisher` does not publish errors.
|
||
public typealias Failure = A.Failure
|
||
|
||
public let a: A
|
||
|
||
public let b: B
|
||
|
||
public let c: C
|
||
|
||
public let d: D
|
||
|
||
public let e: E
|
||
|
||
public let f: F
|
||
|
||
public let g: G
|
||
|
||
public let h: H
|
||
|
||
public init(_ a: A, _ b: B, _ c: C, _ d: D, _ e: E, _ f: F, _ g: G, _ h: H)
|
||
|
||
/// This function is called to attach the specified `Subscriber` to this `Publisher` by `subscribe(_:)`
|
||
///
|
||
/// - SeeAlso: `subscribe(_:)`
|
||
/// - Parameters:
|
||
/// - subscriber: The subscriber to attach to this `Publisher`.
|
||
/// once attached it can begin to receive values.
|
||
public func receive<S>(subscriber: S) where S : Subscriber, H.Failure == S.Failure, H.Output == S.Input
|
||
}
|
||
|
||
public struct MergeMany<Upstream> : Publisher where Upstream : Publisher {
|
||
|
||
/// The kind of values published by this publisher.
|
||
public typealias Output = Upstream.Output
|
||
|
||
/// The kind of errors this publisher might publish.
|
||
///
|
||
/// Use `Never` if this `Publisher` does not publish errors.
|
||
public typealias Failure = Upstream.Failure
|
||
|
||
public let publishers: [Upstream]
|
||
|
||
public init(_ upstream: Upstream...)
|
||
|
||
public init<S>(_ upstream: S) where Upstream == S.Element, S : Sequence
|
||
|
||
/// This function is called to attach the specified `Subscriber` to this `Publisher` by `subscribe(_:)`
|
||
///
|
||
/// - SeeAlso: `subscribe(_:)`
|
||
/// - Parameters:
|
||
/// - subscriber: The subscriber to attach to this `Publisher`.
|
||
/// once attached it can begin to receive values.
|
||
public func receive<S>(subscriber: S) where S : Subscriber, Upstream.Failure == S.Failure, Upstream.Output == S.Input
|
||
|
||
public func merge(with other: Upstream) -> Publishers.MergeMany<Upstream>
|
||
}
|
||
}
|
||
|
||
extension Publisher {
|
||
|
||
/// Combines elements from this publisher with those from another publisher, delivering an interleaved sequence of elements.
|
||
///
|
||
/// The merged publisher continues to emit elements until all upstream publishers finish. If an upstream publisher produces an error, the merged publisher fails with that error.
|
||
/// - Parameter other: Another publisher.
|
||
/// - Returns: A publisher that emits an event when either upstream publisher emits an event.
|
||
public func merge<P>(with other: P) -> Publishers.Merge<Self, P> where P : Publisher, Self.Failure == P.Failure, Self.Output == P.Output
|
||
|
||
/// Combines elements from this publisher with those from two other publishers, delivering an interleaved sequence of elements.
|
||
///
|
||
/// The merged publisher continues to emit elements until all upstream publishers finish. If an upstream publisher produces an error, the merged publisher fails with that error.
|
||
///
|
||
/// - Parameters:
|
||
/// - b: A second publisher.
|
||
/// - c: A third publisher.
|
||
/// - Returns: A publisher that emits an event when any upstream publisher emits
|
||
/// an event.
|
||
public func merge<B, C>(with b: B, _ c: C) -> Publishers.Merge3<Self, B, C> where B : Publisher, C : Publisher, Self.Failure == B.Failure, Self.Output == B.Output, B.Failure == C.Failure, B.Output == C.Output
|
||
|
||
/// Combines elements from this publisher with those from three other publishers, delivering
|
||
/// an interleaved sequence of elements.
|
||
///
|
||
/// The merged publisher continues to emit elements until all upstream publishers finish. If an upstream publisher produces an error, the merged publisher fails with that error.
|
||
///
|
||
/// - Parameters:
|
||
/// - b: A second publisher.
|
||
/// - c: A third publisher.
|
||
/// - d: A fourth publisher.
|
||
/// - Returns: A publisher that emits an event when any upstream publisher emits an event.
|
||
public func merge<B, C, D>(with b: B, _ c: C, _ d: D) -> Publishers.Merge4<Self, B, C, D> where B : Publisher, C : Publisher, D : Publisher, Self.Failure == B.Failure, Self.Output == B.Output, B.Failure == C.Failure, B.Output == C.Output, C.Failure == D.Failure, C.Output == D.Output
|
||
|
||
/// Combines elements from this publisher with those from four other publishers, delivering an interleaved sequence of elements.
|
||
///
|
||
/// The merged publisher continues to emit elements until all upstream publishers finish. If an upstream publisher produces an error, the merged publisher fails with that error.
|
||
///
|
||
/// - Parameters:
|
||
/// - b: A second publisher.
|
||
/// - c: A third publisher.
|
||
/// - d: A fourth publisher.
|
||
/// - e: A fifth publisher.
|
||
/// - Returns: A publisher that emits an event when any upstream publisher emits an event.
|
||
public func merge<B, C, D, E>(with b: B, _ c: C, _ d: D, _ e: E) -> Publishers.Merge5<Self, B, C, D, E> where B : Publisher, C : Publisher, D : Publisher, E : Publisher, Self.Failure == B.Failure, Self.Output == B.Output, B.Failure == C.Failure, B.Output == C.Output, C.Failure == D.Failure, C.Output == D.Output, D.Failure == E.Failure, D.Output == E.Output
|
||
|
||
/// Combines elements from this publisher with those from five other publishers, delivering an interleaved sequence of elements.
|
||
///
|
||
/// The merged publisher continues to emit elements until all upstream publishers finish. If an upstream publisher produces an error, the merged publisher fails with that error.
|
||
///
|
||
/// - Parameters:
|
||
/// - b: A second publisher.
|
||
/// - c: A third publisher.
|
||
/// - d: A fourth publisher.
|
||
/// - e: A fifth publisher.
|
||
/// - f: A sixth publisher.
|
||
/// - Returns: A publisher that emits an event when any upstream publisher emits an event.
|
||
public func merge<B, C, D, E, F>(with b: B, _ c: C, _ d: D, _ e: E, _ f: F) -> Publishers.Merge6<Self, B, C, D, E, F> where B : Publisher, C : Publisher, D : Publisher, E : Publisher, F : Publisher, Self.Failure == B.Failure, Self.Output == B.Output, B.Failure == C.Failure, B.Output == C.Output, C.Failure == D.Failure, C.Output == D.Output, D.Failure == E.Failure, D.Output == E.Output, E.Failure == F.Failure, E.Output == F.Output
|
||
|
||
/// Combines elements from this publisher with those from six other publishers, delivering an interleaved sequence of elements.
|
||
///
|
||
/// The merged publisher continues to emit elements until all upstream publishers finish. If an upstream publisher produces an error, the merged publisher fails with that error.
|
||
///
|
||
/// - Parameters:
|
||
/// - b: A second publisher.
|
||
/// - c: A third publisher.
|
||
/// - d: A fourth publisher.
|
||
/// - e: A fifth publisher.
|
||
/// - f: A sixth publisher.
|
||
/// - g: A seventh publisher.
|
||
/// - Returns: A publisher that emits an event when any upstream publisher emits an event.
|
||
public func merge<B, C, D, E, F, G>(with b: B, _ c: C, _ d: D, _ e: E, _ f: F, _ g: G) -> Publishers.Merge7<Self, B, C, D, E, F, G> where B : Publisher, C : Publisher, D : Publisher, E : Publisher, F : Publisher, G : Publisher, Self.Failure == B.Failure, Self.Output == B.Output, B.Failure == C.Failure, B.Output == C.Output, C.Failure == D.Failure, C.Output == D.Output, D.Failure == E.Failure, D.Output == E.Output, E.Failure == F.Failure, E.Output == F.Output, F.Failure == G.Failure, F.Output == G.Output
|
||
|
||
/// Combines elements from this publisher with those from seven other publishers, delivering an interleaved sequence of elements.
|
||
///
|
||
/// The merged publisher continues to emit elements until all upstream publishers finish. If an upstream publisher produces an error, the merged publisher fails with that error.
|
||
///
|
||
/// - Parameters:
|
||
/// - b: A second publisher.
|
||
/// - c: A third publisher.
|
||
/// - d: A fourth publisher.
|
||
/// - e: A fifth publisher.
|
||
/// - f: A sixth publisher.
|
||
/// - g: A seventh publisher.
|
||
/// - h: An eighth publisher.
|
||
/// - Returns: A publisher that emits an event when any upstream publisher emits an event.
|
||
public func merge<B, C, D, E, F, G, H>(with b: B, _ c: C, _ d: D, _ e: E, _ f: F, _ g: G, _ h: H) -> Publishers.Merge8<Self, B, C, D, E, F, G, H> where B : Publisher, C : Publisher, D : Publisher, E : Publisher, F : Publisher, G : Publisher, H : Publisher, Self.Failure == B.Failure, Self.Output == B.Output, B.Failure == C.Failure, B.Output == C.Output, C.Failure == D.Failure, C.Output == D.Output, D.Failure == E.Failure, D.Output == E.Output, E.Failure == F.Failure, E.Output == F.Output, F.Failure == G.Failure, F.Output == G.Output, G.Failure == H.Failure, G.Output == H.Output
|
||
|
||
/// Combines elements from this publisher with those from another publisher of the same type, delivering an interleaved sequence of elements.
|
||
///
|
||
/// - Parameter other: Another publisher of this publisher's type.
|
||
/// - Returns: A publisher that emits an event when either upstream publisher emits
|
||
/// an event.
|
||
public func merge(with other: Self) -> Publishers.MergeMany<Self>
|
||
}
|
||
|
||
extension Publishers {
|
||
|
||
/// A publisher that attempts to recreate its subscription to a failed upstream publisher.
|
||
public struct Retry<Upstream> : Publisher where Upstream : Publisher {
|
||
|
||
/// The kind of values published by this publisher.
|
||
public typealias Output = Upstream.Output
|
||
|
||
/// The kind of errors this publisher might publish.
|
||
///
|
||
/// Use `Never` if this `Publisher` does not publish errors.
|
||
public typealias Failure = Upstream.Failure
|
||
|
||
/// The publisher from which this publisher receives elements.
|
||
public let upstream: Upstream
|
||
|
||
/// The maximum number of retry attempts to perform.
|
||
///
|
||
/// If `nil`, this publisher attempts to reconnect with the upstream publisher an unlimited number of times.
|
||
public let retries: Int?
|
||
|
||
/// Creates a publisher that attempts to recreate its subscription to a failed upstream publisher.
|
||
///
|
||
/// - Parameters:
|
||
/// - upstream: The publisher from which this publisher receives its elements.
|
||
/// - retries: The maximum number of retry attempts to perform. If `nil`, this publisher attempts to reconnect with the upstream publisher an unlimited number of times.
|
||
public init(upstream: Upstream, retries: Int?)
|
||
|
||
/// This function is called to attach the specified `Subscriber` to this `Publisher` by `subscribe(_:)`
|
||
///
|
||
/// - SeeAlso: `subscribe(_:)`
|
||
/// - Parameters:
|
||
/// - subscriber: The subscriber to attach to this `Publisher`.
|
||
/// once attached it can begin to receive values.
|
||
public func receive<S>(subscriber: S) where S : Subscriber, Upstream.Failure == S.Failure, Upstream.Output == S.Input
|
||
}
|
||
}
|
||
|
||
extension Publisher {
|
||
|
||
/// Attempts to recreate a failed subscription with the upstream publisher using a specified number of attempts to establish the connection.
|
||
///
|
||
/// After exceeding the specified number of retries, the publisher passes the failure to the downstream receiver.
|
||
/// - Parameter retries: The number of times to attempt to recreate the subscription.
|
||
/// - Returns: A publisher that attempts to recreate its subscription to a failed upstream publisher.
|
||
public func retry(_ retries: Int) -> Publishers.Retry<Self>
|
||
}
|
||
|
||
extension Publisher {
|
||
|
||
/// Attempts to recreate a failed subscription with the upstream publisher using a specified number of attempts to establish the connection.
|
||
///
|
||
/// After exceeding the specified number of retries, the publisher passes the failure to the downstream receiver.
|
||
/// - Parameter retries: The number of times to attempt to recreate the subscription.
|
||
/// - Returns: A publisher that attempts to recreate its subscription to a failed upstream publisher.
|
||
public func retry(_ retries: Int) -> Publishers.Retry<Self>
|
||
}
|
||
|
||
extension Publishers {
|
||
|
||
/// A publisher that publishes either the most-recent or first element published by the upstream publisher in a specified time interval.
|
||
public struct Throttle<Upstream, Context> : Publisher where Upstream : Publisher, Context : Scheduler {
|
||
|
||
/// The kind of values published by this publisher.
|
||
public typealias Output = Upstream.Output
|
||
|
||
/// The kind of errors this publisher might publish.
|
||
///
|
||
/// Use `Never` if this `Publisher` does not publish errors.
|
||
public typealias Failure = Upstream.Failure
|
||
|
||
/// The publisher from which this publisher receives elements.
|
||
public let upstream: Upstream
|
||
|
||
/// The interval in which to find and emit the most recent element.
|
||
public let interval: Context.SchedulerTimeType.Stride
|
||
|
||
/// The scheduler on which to publish elements.
|
||
public let scheduler: Context
|
||
|
||
/// A Boolean value indicating whether to publish the most recent element.
|
||
///
|
||
/// If `false`, the publisher emits the first element received during the interval.
|
||
public let latest: Bool
|
||
|
||
public init(upstream: Upstream, interval: Context.SchedulerTimeType.Stride, scheduler: Context, latest: Bool)
|
||
|
||
/// This function is called to attach the specified `Subscriber` to this `Publisher` by `subscribe(_:)`
|
||
///
|
||
/// - SeeAlso: `subscribe(_:)`
|
||
/// - Parameters:
|
||
/// - subscriber: The subscriber to attach to this `Publisher`.
|
||
/// once attached it can begin to receive values.
|
||
public func receive<S>(subscriber: S) where S : Subscriber, Upstream.Failure == S.Failure, Upstream.Output == S.Input
|
||
}
|
||
}
|
||
|
||
extension Publisher {
|
||
|
||
/// Publishes either the most-recent or first element published by the upstream
|
||
/// publisher in the specified time interval.
|
||
///
|
||
/// Use `throttle(for:scheduler:latest:`` to selectively republish elements from
|
||
/// an upstream publisher during an interval you specify. Other elements received from
|
||
/// the upstream in the throttling interval aren’t republished.
|
||
///
|
||
/// In the example below, a `Timer.TimerPublisher` produces elements on 3-second
|
||
/// intervals; the `throttle(for:scheduler:latest:)` operator delivers the first
|
||
/// event, then republishes only the latest event in the following ten second
|
||
/// intervals:
|
||
///
|
||
/// cancellable = Timer.publish(every: 3.0, on: .main, in: .default)
|
||
/// .autoconnect()
|
||
/// .print("\(Date().description)")
|
||
/// .throttle(for: 10.0, scheduler: RunLoop.main, latest: true)
|
||
/// .sink(
|
||
/// receiveCompletion: { print ("Completion: \($0).") },
|
||
/// receiveValue: { print("Received Timestamp \($0).") }
|
||
/// )
|
||
///
|
||
/// // Prints:
|
||
/// // Publish at: 2020-03-19 18:26:54 +0000: receive value: (2020-03-19 18:26:57 +0000)
|
||
/// // Received Timestamp 2020-03-19 18:26:57 +0000.
|
||
/// // Publish at: 2020-03-19 18:26:54 +0000: receive value: (2020-03-19 18:27:00 +0000)
|
||
/// // Publish at: 2020-03-19 18:26:54 +0000: receive value: (2020-03-19 18:27:03 +0000)
|
||
/// // Publish at: 2020-03-19 18:26:54 +0000: receive value: (2020-03-19 18:27:06 +0000)
|
||
/// // Publish at: 2020-03-19 18:26:54 +0000: receive value: (2020-03-19 18:27:09 +0000)
|
||
/// // Received Timestamp 2020-03-19 18:27:09 +0000.
|
||
///
|
||
/// - Parameters:
|
||
/// - interval: The interval at which to find and emit either the most recent or
|
||
/// the first element, expressed in the time system of the scheduler.
|
||
/// - scheduler: The scheduler on which to publish elements.
|
||
/// - latest: A Boolean value that indicates whether to publish the most recent
|
||
/// element. If `false`, the publisher emits the first element received during
|
||
/// the interval.
|
||
/// - Returns: A publisher that emits either the most-recent or first element received
|
||
/// during the specified interval.
|
||
public func throttle<S>(for interval: S.SchedulerTimeType.Stride, scheduler: S, latest: Bool) -> Publishers.Throttle<Self, S> where S : Scheduler
|
||
}
|
||
|
||
extension Publishers.CombineLatest : Equatable where A : Equatable, B : Equatable {
|
||
|
||
/// Returns a Boolean value that indicates whether two publishers are equivalent.
|
||
///
|
||
/// - Parameters:
|
||
/// - lhs: A combineLatest publisher to compare for equality.
|
||
/// - rhs: Another combineLatest publisher to compare for equality.
|
||
/// - Returns: `true` if the corresponding upstream publishers of each combineLatest publisher are equal, `false` otherwise.
|
||
public static func == (lhs: Publishers.CombineLatest<A, B>, rhs: Publishers.CombineLatest<A, B>) -> Bool
|
||
}
|
||
|
||
extension Publishers.CombineLatest3 : Equatable where A : Equatable, B : Equatable, C : Equatable {
|
||
|
||
/// Returns a Boolean value indicating whether two values are equal.
|
||
///
|
||
/// Equality is the inverse of inequality. For any values `a` and `b`,
|
||
/// `a == b` implies that `a != b` is `false`.
|
||
///
|
||
/// - Parameters:
|
||
/// - lhs: A value to compare.
|
||
/// - rhs: Another value to compare.
|
||
public static func == (lhs: Publishers.CombineLatest3<A, B, C>, rhs: Publishers.CombineLatest3<A, B, C>) -> Bool
|
||
}
|
||
|
||
extension Publishers.CombineLatest4 : Equatable where A : Equatable, B : Equatable, C : Equatable, D : Equatable {
|
||
|
||
/// Returns a Boolean value indicating whether two values are equal.
|
||
///
|
||
/// Equality is the inverse of inequality. For any values `a` and `b`,
|
||
/// `a == b` implies that `a != b` is `false`.
|
||
///
|
||
/// - Parameters:
|
||
/// - lhs: A value to compare.
|
||
/// - rhs: Another value to compare.
|
||
public static func == (lhs: Publishers.CombineLatest4<A, B, C, D>, rhs: Publishers.CombineLatest4<A, B, C, D>) -> Bool
|
||
}
|
||
|
||
extension Publishers.Merge : Equatable where A : Equatable, B : Equatable {
|
||
|
||
/// Returns a Boolean value that indicates whether two publishers are equivalent.
|
||
///
|
||
/// - Parameters:
|
||
/// - lhs: A merging publisher to compare for equality.
|
||
/// - rhs: Another merging publisher to compare for equality..
|
||
/// - Returns: `true` if the two merging - rhs: Another merging publisher to compare for equality.
|
||
public static func == (lhs: Publishers.Merge<A, B>, rhs: Publishers.Merge<A, B>) -> Bool
|
||
}
|
||
|
||
extension Publishers.Merge3 : Equatable where A : Equatable, B : Equatable, C : Equatable {
|
||
|
||
/// Returns a Boolean value that indicates whether two publishers are equivalent.
|
||
///
|
||
/// - Parameters:
|
||
/// - lhs: A merging publisher to compare for equality.
|
||
/// - rhs: Another merging publisher to compare for equality.
|
||
/// - Returns: `true` if the two merging publishers have equal source publishers, `false` otherwise.
|
||
public static func == (lhs: Publishers.Merge3<A, B, C>, rhs: Publishers.Merge3<A, B, C>) -> Bool
|
||
}
|
||
|
||
extension Publishers.Merge4 : Equatable where A : Equatable, B : Equatable, C : Equatable, D : Equatable {
|
||
|
||
/// Returns a Boolean value that indicates whether two publishers are equivalent.
|
||
///
|
||
/// - Parameters:
|
||
/// - lhs: A merging publisher to compare for equality.
|
||
/// - rhs: Another merging publisher to compare for equality.
|
||
/// - Returns: `true` if the two merging publishers have equal source publishers, `false` otherwise.
|
||
public static func == (lhs: Publishers.Merge4<A, B, C, D>, rhs: Publishers.Merge4<A, B, C, D>) -> Bool
|
||
}
|
||
|
||
extension Publishers.Merge5 : Equatable where A : Equatable, B : Equatable, C : Equatable, D : Equatable, E : Equatable {
|
||
|
||
/// Returns a Boolean value that indicates whether two publishers are equivalent.
|
||
///
|
||
/// - Parameters:
|
||
/// - lhs: A merging publisher to compare for equality.
|
||
/// - rhs: Another merging publisher to compare for equality.
|
||
/// - Returns: `true` if the two merging publishers have equal source publishers, `false` otherwise.
|
||
public static func == (lhs: Publishers.Merge5<A, B, C, D, E>, rhs: Publishers.Merge5<A, B, C, D, E>) -> Bool
|
||
}
|
||
|
||
extension Publishers.Merge6 : Equatable where A : Equatable, B : Equatable, C : Equatable, D : Equatable, E : Equatable, F : Equatable {
|
||
|
||
/// Returns a Boolean value that indicates whether two publishers are equivalent.
|
||
///
|
||
/// - Parameters:
|
||
/// - lhs: A merging publisher to compare for equality.
|
||
/// - rhs: Another merging publisher to compare for equality.
|
||
/// - Returns: `true` if the two merging publishers have equal source publishers, `false` otherwise.
|
||
public static func == (lhs: Publishers.Merge6<A, B, C, D, E, F>, rhs: Publishers.Merge6<A, B, C, D, E, F>) -> Bool
|
||
}
|
||
|
||
extension Publishers.Merge7 : Equatable where A : Equatable, B : Equatable, C : Equatable, D : Equatable, E : Equatable, F : Equatable, G : Equatable {
|
||
|
||
/// Returns a Boolean value that indicates whether two publishers are equivalent.
|
||
///
|
||
/// - Parameters:
|
||
/// - lhs: A merging publisher to compare for equality.
|
||
/// - rhs: Another merging publisher to compare for equality.
|
||
/// - Returns: `true` if the two merging publishers have equal source publishers, `false` otherwise.
|
||
public static func == (lhs: Publishers.Merge7<A, B, C, D, E, F, G>, rhs: Publishers.Merge7<A, B, C, D, E, F, G>) -> Bool
|
||
}
|
||
|
||
extension Publishers.Merge8 : Equatable where A : Equatable, B : Equatable, C : Equatable, D : Equatable, E : Equatable, F : Equatable, G : Equatable, H : Equatable {
|
||
|
||
/// Returns a Boolean value that indicates whether two publishers are equivalent.
|
||
///
|
||
/// - Parameters:
|
||
/// - lhs: A merging publisher to compare for equality.
|
||
/// - rhs: Another merging publisher to compare for equality.
|
||
/// - Returns: `true` if the two merging publishers have equal source publishers, `false` otherwise.
|
||
public static func == (lhs: Publishers.Merge8<A, B, C, D, E, F, G, H>, rhs: Publishers.Merge8<A, B, C, D, E, F, G, H>) -> Bool
|
||
}
|
||
|
||
extension Publishers.MergeMany : Equatable where Upstream : Equatable {
|
||
|
||
/// Returns a Boolean value indicating whether two values are equal.
|
||
///
|
||
/// Equality is the inverse of inequality. For any values `a` and `b`,
|
||
/// `a == b` implies that `a != b` is `false`.
|
||
///
|
||
/// - Parameters:
|
||
/// - lhs: A value to compare.
|
||
/// - rhs: Another value to compare.
|
||
public static func == (lhs: Publishers.MergeMany<Upstream>, rhs: Publishers.MergeMany<Upstream>) -> Bool
|
||
}
|
||
|
||
extension Publishers.Zip : Equatable where A : Equatable, B : Equatable {
|
||
|
||
/// Returns a Boolean value that indicates whether two publishers are equivalent.
|
||
///
|
||
/// - Parameters:
|
||
/// - lhs: A zip publisher to compare for equality.
|
||
/// - rhs: Another zip publisher to compare for equality.
|
||
/// - Returns: `true` if the corresponding upstream publishers of each zip publisher are equal, `false` otherwise.
|
||
public static func == (lhs: Publishers.Zip<A, B>, rhs: Publishers.Zip<A, B>) -> Bool
|
||
}
|
||
|
||
/// Returns a Boolean value that indicates whether two publishers are equivalent.
|
||
///
|
||
/// - Parameters:
|
||
/// - lhs: A zip publisher to compare for equality.
|
||
/// - rhs: Another zip publisher to compare for equality.
|
||
/// - Returns: `true` if the corresponding upstream publishers of each zip publisher are equal, `false` otherwise.
|
||
extension Publishers.Zip3 : Equatable where A : Equatable, B : Equatable, C : Equatable {
|
||
|
||
/// Returns a Boolean value indicating whether two values are equal.
|
||
///
|
||
/// Equality is the inverse of inequality. For any values `a` and `b`,
|
||
/// `a == b` implies that `a != b` is `false`.
|
||
///
|
||
/// - Parameters:
|
||
/// - lhs: A value to compare.
|
||
/// - rhs: Another value to compare.
|
||
public static func == (lhs: Publishers.Zip3<A, B, C>, rhs: Publishers.Zip3<A, B, C>) -> Bool
|
||
}
|
||
|
||
/// Returns a Boolean value that indicates whether two publishers are equivalent.
|
||
///
|
||
/// - Parameters:
|
||
/// - lhs: A zip publisher to compare for equality.
|
||
/// - rhs: Another zip publisher to compare for equality.
|
||
/// - Returns: `true` if the corresponding upstream publishers of each zip publisher are equal, `false` otherwise.
|
||
extension Publishers.Zip4 : Equatable where A : Equatable, B : Equatable, C : Equatable, D : Equatable {
|
||
|
||
/// Returns a Boolean value indicating whether two values are equal.
|
||
///
|
||
/// Equality is the inverse of inequality. For any values `a` and `b`,
|
||
/// `a == b` implies that `a != b` is `false`.
|
||
///
|
||
/// - Parameters:
|
||
/// - lhs: A value to compare.
|
||
/// - rhs: Another value to compare.
|
||
public static func == (lhs: Publishers.Zip4<A, B, C, D>, rhs: Publishers.Zip4<A, B, C, D>) -> Bool
|
||
}
|