Give users direct access to bitflags and enumeration constants#554
Give users direct access to bitflags and enumeration constants#554
Conversation
7dac902 to
081e31d
Compare
|
Making the inner type public seems fine, but please don't deprecate |
|
@aloucks just like my PR description above you will have to justify your comment otherwise there's no way for me to even consider honouring your request. In other words: why? |
What makes this preferred? It wouldn't be my preference. I guess this is subjective, but requiring newtype syntax in a public API is unappealing to me. Removing the methods and making the inner component public is a step in the direction towards making them a simple typedef. I think we can all agree is not the right choice. Why do we want to move in this direction? Furthermore, with this change, the way you construct a bitflag type and a handle type from a raw value now uses different API, where as without this PR both use a common |
|
My feeling is that it's a pretty minor cosmetic difference to be spending buildtime on, but I also don't feel too strongly either way. Do you actually have a bunch of code calling these methods? I'd have thought conversions to/from raw form would tend to be isolated. |
I am preferring it because it looks more natural to write By the way I can't help but notice that I've been writing it "wrongly" as
Not at all. A newtype is still fundamentally different from a typedef no matter the inner value being Agreed though, dropping the
Bitflags are still different from handles, especially the dispatchable one that performs a cast between a raw Either way this PR was really only sparked as a means to accommodate the |
That's not entirely correct either. The
Prefix Cost Ownership |
|
These are very much |
Nothing special happens when converting to and from these constants, and its API is found to be more concise yet ever so slightly (0.1s) faster to compile than having separate `to_raw` and `from_raw` functions for each, that it makes sense to drop these entirely. Ash is still on a nonbreaking contribution streak so these functions are marked `deprecated` for now and will be removed at the next breaking crate release. [1]: #549 (comment)
081e31d to
3511dfc
Compare
|
@aloucks Fair enough, I didn't read my own link 🤦 Not sure what else it should be then though, if everything in that table is wrong... For the bitflags we could/should definitely match Anyway, should we leave this for a future discussion/PR and solely focus on whether to keep these functions in the first place / make the inner type public, per the initial intent of the PR? At this point I'm feeling more and more indifferent to it all. |
|
Works for me. Decisions are always easier one at a time. |
|
Honestly I have no strong preference here. I'd keep the Having both |
Of course they're marked On that note, is this still something we want in? Repeating what I said before: this PR is mainly to smoothen the |
|
Given that IMO |
|
Closing this as being unclear and not worth the trouble. I don't think we should reopen #549 then either. While using type-safe functions is preferred this is probably not worth the trouble for a few |
Nothing special happens when converting to and from these constants, and its API is found to be more concise yet ever so slightly (0.1s) faster to compile than having separate
to_rawandfrom_rawfunctions for each 1, that it makes sense to drop these entirely. Ash is still on a nonbreaking contribution streak so these functions are markeddeprecatedfor now and will be removed at the next breaking crate release.