Giter VIP home page Giter VIP logo

Comments (6)

hdevalence avatar hdevalence commented on May 23, 2024

Can we make the From impl a const fn?

from subtle.

hdevalence avatar hdevalence commented on May 23, 2024

I'm not totally clear on the details but from https://varkor.github.io/blog/2019/01/11/const-types-traits-and-implementations-in-Rust.html it looks like it may be possible to just declare the From impl we have to be const.

from subtle.

ebfull avatar ebfull commented on May 23, 2024

In the future it will be possible to do this, yes, but I'm not optimistic about the timeframe. It's worth considering a temporary solution that can be deprecated later.

from subtle.

hdevalence avatar hdevalence commented on May 23, 2024

Ah, sorry, I misunderstood the blog post I linked -- I thought it was talking about the current design and not a future expansion. If you have a usecase for constructing const Choices, we could think about adding a from_const_u8 with a warning-of-future-deprecation.

from subtle.

ebfull avatar ebfull commented on May 23, 2024

In some of my code I have structures which contain a Choice to indicate something about the value (that it's the point at infinity), but when they contain a Choice I cannot create constant values (like the point at infinity) for the structure anymore.

from subtle.

hdevalence avatar hdevalence commented on May 23, 2024

I would be happy to add a from_const_u8 with a doc comment noting the potential for future deprecation if that PR existed, but I would prefer to close this issue as "resolved discussion" until then :)

from subtle.

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.