FlattenStrategy

public enum FlattenStrategy: Equatable

Describes how multiple producers should be joined together.

  • The producers should be merged, so that any value received on any of the input producers will be forwarded immediately to the output producer.

    The resulting producer will complete only when all inputs have completed.

    Declaration

    Swift

    public static let merge = FlattenStrategy.concurrent(limit: .max)
  • The producers should be concatenated, so that their values are sent in the order of the producers themselves.

    The resulting producer will complete only when all inputs have completed.

    Declaration

    Swift

    public static let concat = FlattenStrategy.concurrent(limit: 1)
  • Only the events from the first input producer to send an event (winning producer) should be considered for the output. Any other producers that already started (but not sending an event yet) will be disposed.

    The resulting producer will complete when: 1. The producer-of-producers and the first alive producer has completed. 2. The producer-of-producers has completed without inner producer being alive.

    Declaration

    Swift

    public static func ==(left: FlattenStrategy, right: FlattenStrategy) -> Bool

    Parameters

    lhs

    A value to compare.

    rhs

    Another value to compare.

  • The producers should be merged, but only up to the given limit at any point of time, so that any value received on any of the input producers will be forwarded immediately to the output producer.

    When the number of active producers reaches the limit, subsequent producers are queued.

    The resulting producer will complete only when all inputs have completed.

    Precondition

    limit > 0.

    Declaration

    Swift

    case concurrent(limit: UInt)
  • Only the events from the latest input producer should be considered for the output. Any producers received before that point will be disposed of.

    The resulting producer will complete only when the producer-of-producers and the latest producer has completed.

    Declaration

    Swift

    case latest
  • Only the events from the first input producer to send an event (winning producer) should be considered for the output. Any other producers that already started (but not sending an event yet) will be disposed.

    The resulting producer will complete when: 1. The producer-of-producers and the first alive producer has completed. 2. The producer-of-producers has completed without inner producer being alive.

    Declaration

    Swift

    case race