-
Notifications
You must be signed in to change notification settings - Fork 180
1.0 compatibility for share operator #369
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 14 commits
42950e0
8c13d4b
3c07b64
22bb49e
474e461
7d7ee6f
1b6b715
1626281
38e635e
6b1b6f5
c02d4ed
aa7a6c5
7c9dba7
81493be
4345c0d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,18 @@ | ||||||
//===----------------------------------------------------------------------===// | ||||||
// | ||||||
// This source file is part of the Swift Async Algorithms open source project | ||||||
// | ||||||
// Copyright (c) 2022 Apple Inc. and the Swift project authors | ||||||
|
// Copyright (c) 2022 Apple Inc. and the Swift project authors | |
// Copyright (c) 2025 Apple Inc. and the Swift project authors |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There seems to be some other ones that I copy/pasta'd too .... oops...
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// | ||
// FailingSequence.swift | ||
// swift-async-algorithms | ||
// | ||
// Created by Stefano Mondino on 15/10/25. | ||
// | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should also be updated to the right attribution header: //===----------------------------------------------------------------------===//
//
// This source file is part of the Swift Async Algorithms open source project
//
// Copyright (c) 2025 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.2, *) | ||
struct FailingSequence<Failure: Error>: AsyncSequence, Sendable { | ||
typealias Element = Void | ||
let error: Failure | ||
init(_ error: Failure) { | ||
self.error = error | ||
} | ||
func makeAsyncIterator() -> AsyncIterator { AsyncIterator(error: error) } | ||
|
||
struct AsyncIterator: AsyncIteratorProtocol, Sendable { | ||
let error: Failure | ||
func next() async throws(Failure) -> Void? { | ||
throw error | ||
} | ||
mutating func next(completion: @escaping (Result<Element?, Failure>) -> Void) async throws(Failure) -> Element? { | ||
throw error | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.