Skip to content

Conversation

@phausler
Copy link
Member

@phausler phausler commented Jan 11, 2022

This adds asynchronous parity for initialization with collection types for use with AsyncSequence as it exists today for Sequence.

@phausler phausler changed the title [WIP] Add async rethrowing initializers for RangeReplaceableCollection, SetAlgebra, and Dictionary for use with AsyncSequence types Add async rethrowing initializers for RangeReplaceableCollection, SetAlgebra, and Dictionary for use with AsyncSequence types Jan 12, 2022
Copy link
Member

@natecook1000 natecook1000 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! A couple misspellings in the tests but otherwise 👍

/// - Parameter surce: The asynchronous sequence of elements for the new collection.
@inlinable
public init<Source: AsyncSequence>(_ source: Source) async rethrows where Source.Element == Element {
self.init()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AsyncSequence doesn't have any notion of underestimatedCount, does it?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nope; AsyncSequence is about 50/50 finite/indefinite so that was decided to be skipped during the initial design.

phausler and others added 2 commits January 12, 2022 14:47
Co-authored-by: Nate Cook <natecook@apple.com>
Co-authored-by: Nate Cook <natecook@apple.com>
@phausler phausler merged commit 1c08de7 into main Jan 14, 2022
@phausler phausler deleted the pr/collection_initializers branch January 14, 2022 16:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants