Giter Club home page Giter Club logo

Comments (6)

JoshuaBatty avatar JoshuaBatty commented on July 24, 2024 3

Just been taking a look into this issue with @mitchmindtree. Unfortunately, I don't think rust will let us expand an expression given to the second argument into a string at the time of procedural macro expansion. grrrrr shakes fist at rust

Perhaps another solution is to find the logic that include_str! is doing and copy that over as a function instead. I'll see if I can track down what code is actually being called internally.

from fuels-rs.

digorithm avatar digorithm commented on July 24, 2024 2

Love this idea, let's do it!

from fuels-rs.

digorithm avatar digorithm commented on July 24, 2024 2

Damn you Rust!

image

But yeah, fair enough, #97 sounds like a good option too.

from fuels-rs.

mitchmindtree avatar mitchmindtree commented on July 24, 2024 1

Yeah 🤦

Unfortunately it looks like we can't evaluate an expression given to the second argument to a string that we can actually use to generate the Contract type during proc macro expansion. I imagine that might be why abigen! is the way it is now!

There's some writing on this limitation on expanding macros in argument position of other macros here.

Barring that, I think @JoshuaBatty's suggestion of modelling our "path" source behaviour after include_str! is a good idea. I'll close this and open another dedicated issue.

from fuels-rs.

mitchmindtree avatar mitchmindtree commented on July 24, 2024

This may also solve #93 as a side effect.

from fuels-rs.

digorithm avatar digorithm commented on July 24, 2024

True, include_str! should work on multiple platforms... Very nice side effect 😁

from fuels-rs.

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.