From b11a32fe4ec4cafa42a2a264c2449d3fadeca3e1 Mon Sep 17 00:00:00 2001 From: Philippe Hausler Date: Fri, 18 Mar 2022 13:32:15 -0700 Subject: [PATCH] First pass at some documentation for combineLatest (#94) * First pass at some documentation for combineLatest * Add additional docs for extension methods and AsyncCombineLatest2Sequence structure --- Sources/AsyncAlgorithms/AsyncCombineLatest2Sequence.swift | 4 ++++ Sources/AsyncAlgorithms/AsyncCombineLatest3Sequence.swift | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/Sources/AsyncAlgorithms/AsyncCombineLatest2Sequence.swift b/Sources/AsyncAlgorithms/AsyncCombineLatest2Sequence.swift index 3a58653..9db4d34 100644 --- a/Sources/AsyncAlgorithms/AsyncCombineLatest2Sequence.swift +++ b/Sources/AsyncAlgorithms/AsyncCombineLatest2Sequence.swift @@ -9,10 +9,13 @@ // //===----------------------------------------------------------------------===// +/// Creates an asynchronous sequence that combines the latest values from two `AsyncSequence` types +/// by emitting a tuple of the values. public func combineLatest(_ base1: Base1, _ base2: Base2) -> AsyncCombineLatest2Sequence { AsyncCombineLatest2Sequence(base1, base2) } +/// An `AsyncSequence` that combines the latest values produced from two asynchronous sequences into an asynchronous sequence of tuples. public struct AsyncCombineLatest2Sequence: Sendable where Base1: Sendable, Base2: Sendable, @@ -30,6 +33,7 @@ public struct AsyncCombineLatest2Sequence, Base1.AsyncIterator) diff --git a/Sources/AsyncAlgorithms/AsyncCombineLatest3Sequence.swift b/Sources/AsyncAlgorithms/AsyncCombineLatest3Sequence.swift index a0ee829..e182a43 100644 --- a/Sources/AsyncAlgorithms/AsyncCombineLatest3Sequence.swift +++ b/Sources/AsyncAlgorithms/AsyncCombineLatest3Sequence.swift @@ -9,10 +9,13 @@ // //===----------------------------------------------------------------------===// +/// Creates an asynchronous sequence that combines the latest values from three `AsyncSequence` types +/// by emitting a tuple of the values. public func combineLatest(_ base1: Base1, _ base2: Base2, _ base3: Base3) -> AsyncCombineLatest3Sequence { AsyncCombineLatest3Sequence(base1, base2, base3) } +/// An `AsyncSequence` that combines the latest values produced from three asynchronous sequences into an asynchronous sequence of tuples. public struct AsyncCombineLatest3Sequence: Sendable where Base1: Sendable, Base2: Sendable, Base3: Sendable, @@ -32,6 +35,7 @@ public struct AsyncCombineLatest3Sequence, Base3>.Iterator