From d1a8f225ebe35ecc43d007dc0bcb146383f1de59 Mon Sep 17 00:00:00 2001 From: Philippe Hausler Date: Fri, 21 Jan 2022 11:52:15 -0800 Subject: [PATCH] Add documentation for AsyncLazySequence (#4) --- Sources/AsyncAlgorithms/AsyncLazySequence.swift | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Sources/AsyncAlgorithms/AsyncLazySequence.swift b/Sources/AsyncAlgorithms/AsyncLazySequence.swift index 2e9ba8f..2aa01c2 100644 --- a/Sources/AsyncAlgorithms/AsyncLazySequence.swift +++ b/Sources/AsyncAlgorithms/AsyncLazySequence.swift @@ -10,12 +10,23 @@ //===----------------------------------------------------------------------===// extension Sequence { + /// An asynchronous sequence containing the same elements as this sequence, + /// but on which operations, such as `map` and `filter`, are + /// implemented asynchronously. @inlinable public var async: AsyncLazySequence { AsyncLazySequence(self) } } +/// An asynchronous sequence composed from a synchronous sequence. +/// +/// Asynchronous lazy sequences can be used to interface existing or pre-calculated +/// data to interoperate with other asynchronous sequences and algoritms based on +/// asynchronous sequences. +/// +/// This functions similarly to `LazySequence` by accessing elemetns sequentially +/// in the iterators next method. @frozen public struct AsyncLazySequence: AsyncSequence { public typealias Element = Base.Element