Bug 1828217 - Add from_bits_retain for increased compatibility. r=emilio

Differential Revision: https://phabricator.services.mozilla.com/D175710
This commit is contained in:
Mike Hommey 2023-04-18 20:57:49 +00:00
parent 6a16e9e717
commit c996a2aa5b

View File

@ -46,6 +46,15 @@ macro_rules! bitflags {
}
}
impl $BitFlags {
/// Convert from underlying bit representation, preserving all
/// bits (even those not corresponding to a defined flag).
#[inline]
pub const fn from_bits_retain(bits: $T) -> Self {
Self { bits }
}
}
bitflags! {
$($t)*
}