@@ -112,18 +112,18 @@ pub use enumflags2_derive::bitflags_internal as bitflags;
112112
113113// Internal macro: expand into a separate copy for each supported numeric type.
114114macro_rules! for_each_uint {
115- ( $d: tt $tyvar: ident $dd: tt $docattr: ident => $( $input: tt) * ) => {
115+ ( $d: tt $tyvar: ident $dd: tt $atomic : ident $ddd : tt $ docattr: ident => $( $input: tt) * ) => {
116116 macro_rules! implement {
117- ( $d $tyvar: ty => $d( $d $docattr: meta) ? ) => {
117+ ( $d $tyvar: ty, $d $atomic : ident => $d( $d $docattr: meta) ? ) => {
118118 $( $input) *
119119 }
120120 }
121121
122- implement! { u8 => }
123- implement! { u16 => doc( hidden) }
124- implement! { u32 => doc( hidden) }
125- implement! { u64 => doc( hidden) }
126- implement! { u128 => doc( hidden) }
122+ implement! { u8 , AtomicU8 => }
123+ implement! { u16 , AtomicU16 => doc( hidden) }
124+ implement! { u32 , AtomicU32 => doc( hidden) }
125+ implement! { u64 , AtomicU64 => doc( hidden) }
126+ implement! { u128 , AtomicU128 => doc( hidden) }
127127 }
128128}
129129
@@ -334,8 +334,9 @@ pub mod _internal {
334334 }
335335
336336 use :: core:: fmt;
337- use :: core:: ops:: { BitAnd , BitOr , BitXor , Not , Sub } ;
338337 use :: core:: hash:: Hash ;
338+ use :: core:: ops:: { BitAnd , BitOr , BitXor , Not , Sub } ;
339+ use :: core:: sync:: atomic;
339340
340341 pub trait BitFlagNum :
341342 Default
@@ -353,15 +354,17 @@ pub mod _internal {
353354 + Clone
354355 {
355356 const ONE : Self ;
357+ type Atomic ;
356358
357359 fn is_power_of_two ( self ) -> bool ;
358360 fn count_ones ( self ) -> u32 ;
359361 fn wrapping_neg ( self ) -> Self ;
360362 }
361363
362- for_each_uint ! { $ty $hide_docs =>
364+ for_each_uint ! { $ty $atomic $ hide_docs =>
363365 impl BitFlagNum for $ty {
364366 const ONE : Self = 1 ;
367+ type Atomic = atomic:: $atomic;
365368
366369 fn is_power_of_two( self ) -> bool {
367370 <$ty>:: is_power_of_two( self )
0 commit comments