DemandLedger

@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
public struct DemandLedger<Time> where Time : Strideable, Time.Stride : SchedulerTimeIntervalConvertible
extension DemandLedger: Sequence
extension DemandLedger: RangeReplaceableCollection
extension DemandLedger: ExpressibleByArrayLiteral
extension DemandLedger: Equatable

A sequence of Subscribers.Demand transactions.

DemandLedger‘s can be compared to see if they match expectations.

  • The kind of transcation for a DemandLedger

    • .credit(amount:): The raise in authorized demand issued by a Subscriber.
    • .debit(authorized:): The consumption of credit by an upstream Publisher. The debit is only considered authorised if the overall credit is greater or equal to the total debit over the lifetime of a subscription. A debit always has an implicit amount of 1.
    See more

    Declaration

    Swift

    public enum Transaction<Time> : Equatable where Time : Strideable, Time.Stride : SchedulerTimeIntervalConvertible
    extension DemandLedger.Transaction: CustomDebugStringConvertible
  • Initializes a pre-populated DemandLedger

    Declaration

    Swift

    public init<S>(_ elements: S) where S : Sequence, S.Element == DemandLedger<Time>.Element

    Parameters

    elements

    A sequence of elements of the format (VirtualTime, Subscribers.Demand, Transaction<Time>)

  • Initializes an empty DemandLedger

    Declaration

    Swift

    public init()

Sequence conformance

RangeReplaceableCollection conformance

ExpressibleByArrayLiteral conformance

Equatable conformance

  • Declaration

    Swift

    public static func == (lhs: DemandLedger<Time>, rhs: DemandLedger<Time>) -> Bool