Giter VIP home page Giter VIP logo

Comments (4)

rodrigorc avatar rodrigorc commented on June 10, 2024 3

I managed to annotate the return type by writing this:

let stream = try_stream! {
    //...
};
let _: &dyn Stream<Item=Result<_, MyError>> = &stream;

Not the prettiest code, but it gets the job done and looks better than the auxiliary function.
I've checked the generated assembly and it has zero cost.

from async-stream.

carllerche avatar carllerche commented on June 10, 2024

I don't see you yielding anywhere in this example.

from async-stream.

carllerche avatar carllerche commented on June 10, 2024

Unfortunately, "terrible compilation errors" is going to be a limitation of this crate & the macro strategy. Doing better on the compilation error front will require rustc to provide stream generators.

Sorry :(

from async-stream.

dbrgn avatar dbrgn commented on June 10, 2024

Sorry, the yield was in the part that was omitted in the error message 🙂

Sure, that's fine, I just wondered whether there's an easy way to annotate the return type, so that I won't have to create a helper function. But helper functions work just fine.

from async-stream.

Related Issues (20)

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.