You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would be nice if the generated types had conversions to and from the underlying integer type, where the conversion to the underlying type calls bits, and the conversion from the underlying type calls eitherfrom_bits_truncate (if infallible) or from_bits (if fallible).
If there is interest in adding this I can make a PR.
The text was updated successfully, but these errors were encountered:
So we can’t actually add these From impls ourselves since a consumer might do it, but with #220 merged we could consider a #[bitflags_derive] crate that allowed deriving From and TryFrom.
Just coming back in through some triage. This isn't something we can or necessarily should add to bitflags itself, since users can write their own From impls, and there isn't a single universally correct implementation to choose. Whether you want to truncate or preserve additional bits is up to the author of the flags type to determine.
I'll go ahead and close this one now as something we won't be directly pursuing, but thanks for the suggestion!
It would be nice if the generated types had conversions to and from the underlying integer type, where the conversion to the underlying type calls
bits
, and the conversion from the underlying type calls eitherfrom_bits_truncate
(if infallible) orfrom_bits
(if fallible).If there is interest in adding this I can make a PR.
The text was updated successfully, but these errors were encountered: