Git Product home page Git Product logo

Comments (2)

Fuuzetsu avatar Fuuzetsu commented on August 16, 2024

Thanks for quick reaction!

w.r.t. why it was this way: I'm looking at handle_named_variant and that looks very similar except in that case we have fields which means < comparison catches it: perhaps unit was modeled on it and never adapted to do something more efficient. Maybe a range match is better there or something but that's for another day – unit variant is what I care about in this ticket.

from enum-map.

KamilaBorowska avatar KamilaBorowska commented on August 16, 2024

handle_named_variant uses < because it needs to (the number of variants is variable for named variants), and I assume handle_unit_variant got < from it.

As for why if is used rather than match, this is because match arms don't accept const expressions (inline-const is currently nightly only - rust-lang/rust#76001). At some point I think I would like to implement a special case for enums that only have unit variants that uses match for those (to shorten compilation times when having a lot of enums), but I didn't do that yet

from enum-map.

Related Issues (14)

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.