Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions Sources/AsyncAlgorithms/AsyncLazySequence.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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<Self> {
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<Base: Sequence>: AsyncSequence {
public typealias Element = Base.Element
Expand Down