contain-rs / enum-set Goto Github PK
View Code? Open in Web Editor NEWA structure for holding a set of enum variants
Home Page: https://contain-rs.github.io/enum-set/enum_set
License: Apache License 2.0
A structure for holding a set of enum variants
Home Page: https://contain-rs.github.io/enum-set/enum_set
License: Apache License 2.0
Just wanted to notify you, if you haven't noticed it yet..
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.
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.
Since the the both traits convert an enum
into an unsigned int and back, it would be nice to merge that functionality into one place. It would also let you piggyback off enum-set
's derive.
I'm confused on which commit denotes v0.0.6 on this repo: https://crates.io/crates/enum-set
Cargo.toml is at v0.0.4
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.
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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.