Skip to content

tracking issue for async_iter #257

@nxtlo

Description

@nxtlo

This is a tracking issue for asynchronous version of Iterator and the Stream object.

Public API

the two core interfaces are AsyncIterator which is the core, heart and soul. the trait itself, and Stream, Which is a basic general-purpose impl of an async iterator.

@rustc_diagnostic_item("async_iterator")
class AsyncIterator[Item](ABC):
    async def poll_next(self) -> Option[Item]: ...
    @abstractmethod
    async def __anext__(self) -> Item: ...
    def __aiter__(self) -> Self: ...
    async def __await__(self) -> MutableSequence[Item]: ...

type Poller[T] = AsyncIterable[T] | Iterable[T]

@final
class Stream[T](AsyncIterator[T]):
    def __init__(self, it: Poller[T]) -> None: ...
    # impl AsyncIterator

# turns any iterable into a stream.
def into_stream[T](it: Poller[T]) -> Stream[T]: ...

Steps / History

Unresolved Questions

  • should we impl every, single adapter that Iterator provides?

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-tracking-issueCategory: A tracking issue for a feature request, i.e: not implemented / a PR.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions