Coder Social home page Coder Social logo

futures-state-stream's Introduction

futures-state-stream

CircleCI

Documentation

A version of the futures crate's Stream which returns state on completion

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

futures-state-stream's People

Contributors

djc avatar sfackler avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

djc khuey

futures-state-stream's Issues

Expecting fold() to yield (Accumulator, State)

I was trying to use StateStream::fold() just now. I have a StateStream that yields protocol responses from the network and has the underlying transport as state. However, the current implementation of fold() seems to want to subsume the State into the accumulator. If fold instead yielded the complete accumulator and state together, the next step in the future chain could always do the same thing that's now done in the done argument function.

Does that make sense? It could be implemented as a fold_state(), but since (I think) the old behavior is trivially available, it might make more sense to just replace fold().

Nothing implements StreamExt

I tried to convert futures::stream::Stream to futures_state_stream::StateStream but found out that into_state_stream cann't be applied for Stream.
Should StreamExt be implemented for any implements Stream like FutureExt is implemented for any implements Future

What to do if I don't have State on Err?

So I just tried to update tokio-imap to 0.2, and ran into issues: in https://github.com/djc/tokio-imap/blob/master/src/client/mod.rs#L74, I have a poll method that's supposed to (a) poll the send future to get the transport back, (b) poll the transport for responses to the command I just sent and return them as StreamEvent::Next, and (c) when the final command response is received, emit StreamEvent::Done. However, if the code in (a) fails (on line 85), what am I supposed to do with the new API?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.