Skip to content

Latest commit

 

History

History
37 lines (26 loc) · 1.27 KB

File metadata and controls

37 lines (26 loc) · 1.27 KB

AsyncSyncSequence

This operation is available for all Sequence types.

[Source | Tests]

letnumbers=[1,2,3,4].asyncletcharacters="abcde".async

This transformation can be useful to test operations specifically available on AsyncSequence but also is useful to combine with other AsyncSequence types to provide well known sources of data.

Detailed Design

The .async property returns an AsyncSyncSequence that is generic upon the base Sequence it was constructed from.

extensionSequence{publicvarasync:AsyncSyncSequence<Self>{get}}publicstructAsyncSyncSequence<Base:Sequence>:AsyncSequence{...}extensionAsyncSyncSequence:Sendablewhere Base:Sendable{}extensionAsyncSyncSequence.Iterator:Sendablewhere Base.Iterator:Sendable{}

Naming

This property's and type's name match the naming approaches in the Swift standard library. The property is named with a succinct name in inspiration from .lazy, and the type is named in reference to the lazy behavior of the constructed AsyncSequence.

close