You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So in the series “here is a stream adapter I wanted and thus wrote so do you want it?”, now comes the FoldWithStream stream adapter, that:
Consumes the stream
Passes its first element as well as the remainder to a folding function
Recovers the stream to be continued from the folding function
Iterates
So I'm thinking for this one there might be better ways to do it. However, the best I managed with “standard” stream adapters is the stuff I deleted in Ekleog/kannader@b6e0aff … because it stack overflow'd.
So here is what I have written, if you think it'd be useful that I PR it I can do so. :)
I, too, have run into a case where I needed this exact combinator. I think it was when trying to thread a BiLock through a stream.
My gut feeling is that, if a stream becomes complex enough to require this behavior, it might be time to implement Stream with a bespoke struct. I also think that the core stream/future combinators should be limited to those that have widely applicable use. I think there's room for an external crate to experiment with things like this -- streamtools/futuretools, dual to itertools.
So in the series “here is a stream adapter I wanted and thus wrote so do you want it?”, now comes the
FoldWithStream
stream adapter, that:So I'm thinking for this one there might be better ways to do it. However, the best I managed with “standard” stream adapters is the stuff I deleted in Ekleog/kannader@b6e0aff … because it stack overflow'd.
So here is what I have written, if you think it'd be useful that I PR it I can do so. :)
The text was updated successfully, but these errors were encountered: