Github Implement try_chunks by ivan770 · Pull Request #2438 · rust-lang/futures-...
source link: https://github.com/rust-lang/futures-rs/pull/2438
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Thanks for the PR! I'm ok with adding such a feature, but I'm not sure if the behavior when an error occurs is good with this.
I feel it might be preferable to have our own error type that contains the error returned by the stream and the elements of the buffer at the time the error occurred.
What do you think?
Yeah, I thought about adding a tuple of all elements before error and the error itself, but my approach would lead to conversion of TryStream
to Stream
. I think your approach with custom error type seems more suitable, as TryStream
is preserved. I'll modify PR a bit later.
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK