Giter VIP home page Giter VIP logo

enum-set's People

Contributors

apasel422 avatar flashcat avatar gankra avatar linkmauve avatar reem avatar retep998 avatar rnewman avatar twinklebear avatar upsuper avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

enum-set's Issues

Allow converting to or from a u32?

Seems like this crate would be most useful if it allowed converting either to or from a (say, serialized) u32.

#18 already exposes new_with_bits, but it seems like that doesn't do any checking for whether the enum even supports those bits. Might it be worth having checked and unchecked variants?

For converting into a u32, a simple impl From<EnumSet> for u32 should be sufficient.

Improve `CLike`'s documentation

The set uses the value returned by to_u32 as the index of the bit in its bits field, but the current documentation just says that the two methods "convert" back and forth between the enum type and a u32, and no mention is made of the requirement imposed by the assert in the bit function that the returned value be at most 31.

Send and Sync

Is there a reason why the EnumSet struct definition contains PhantomData<*mut E> instead of PhantomData<E>? The former means that every EnumSet isn't Send or Sync, which is quite limiting.

Derive CLike (e.g. via custom_derive)

The CLike trait has a very boilerplate-ish implementation in most cases, and it could be easily derived.

The easy way to do it is to add an macro that works with the custom_derive crate. The more sophisticated approach would be a dedicated proc_macro crate.

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.