Skip to content

Commit

Permalink
Merge pull request #229 from bprosnitz/patch-1
Browse files Browse the repository at this point in the history
Make from_bits a const fn
  • Loading branch information
KodrAus committed May 11, 2021
2 parents bd24f9d + c3fb4e6 commit f356929
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/lib.rs
Expand Up @@ -632,7 +632,7 @@ macro_rules! __impl_bitflags {
/// Convert from underlying bit representation, unless that
/// representation contains bits that do not correspond to a flag.
#[inline]
pub fn from_bits(bits: $T) -> $crate::_core::option::Option<$BitFlags> {
pub const fn from_bits(bits: $T) -> $crate::_core::option::Option<$BitFlags> {
if (bits & !$BitFlags::all().bits()) == 0 {
$crate::_core::option::Option::Some($BitFlags { bits })
} else {
Expand Down

0 comments on commit f356929

Please sign in to comment.