eclipse-score / eclipse-score/communication

Add a buffered AsyncIterator helper struct

Open
#18 1 comment 0 reactions 0 assignees View on GitHub
rust-api
Dominant language
C++
Stars
62
Forks
97
Avg merge
1d 1h
Merged PRs (30d)
72

Description

# Purpose

In most cases, receivers of event data just want a "stream of data" that comes from the event. We therefore want to add an API that enables a subscription to be turned into a Stream / AsyncIterator so that a task can be created which consumes data asynchronously.

# Outline

```rust
pub struct StreamingSubscription {}

impl std::async_iter::AsyncIterator for StreamingSubscription {
...
}

impl std::async_iter::IntoAsyncIterator for for S where S: Subscription {
type Item = T;
type IntoAsyncIter = StreamingSubscription;
...
}
```

Maybe we also need to say something about a buffer size or which buffer is to be used internally, maybe as an option for power users who want / need to control this.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.