- Notifications
You must be signed in to change notification settings - Fork 162
/
Copy pathSetAlgebra.swift
26 lines (25 loc) · 929 Bytes
/
SetAlgebra.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
25
26
//===----------------------------------------------------------------------===//
//
// 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,*)
extensionSetAlgebra{
/// Creates a new set from an asynchronous sequence of items.
///
/// Use this initializer to create a new set from an asynchronous sequence
///
/// - Parameter source: The elements to use as members of the new set.
@inlinable
publicinit<Source:AsyncSequence>(_ source:Source)asyncrethrowswhere Source.Element ==Element{
self.init()
fortryawaititemin source {
insert(item)
}
}
}