Skip to content
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

Adjust async API so HeaderReader and OggStreamReader can be chained #23

Open
tuxmark5 opened this issue Nov 30, 2017 · 0 comments
Open

Comments

@tuxmark5
Copy link

It should be possible to write something like this:

let stream = HeadersReader::new(data_reader)
  .and_then(|(reader, headers)| OggStreamReader::new(reader, headers))
  .flatten_stream();

#[async]
for packet_block in stream {
  for packet in packet_block {
    stream_yield!(packet);
  }
}

Right now this is not possible, as and_then takes the ownership of HeadersReader. This would be fine if not for OggStreamReader, which requires passing the original HeadersReader to it.

So HeadersReader Future should return not only header set, but also itself or some other object that can be given to OggStreamReader to continue reading the ogg file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants