- Notifications
You must be signed in to change notification settings - Fork 162
/
Copy pathRangeReplaceableCollection.swift
24 lines (23 loc) · 911 Bytes
/
RangeReplaceableCollection.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
//===----------------------------------------------------------------------===//
//
// This source file is part of the Swift Async Algorithms open source project
//
// Copyright (c) 2022 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
//
//===----------------------------------------------------------------------===//
@available(AsyncAlgorithms 1.0,*)
extensionRangeReplaceableCollection{
/// Creates a new instance of a collection containing the elements of an asynchronous sequence.
///
/// - Parameter source: The asynchronous sequence of elements for the new collection.
@inlinable
publicinit<Source:AsyncSequence>(_ source:Source)asyncrethrowswhere Source.Element ==Element{
self.init()
fortryawaititemin source {
append(item)
}
}
}