File tree Expand file tree Collapse file tree 2 files changed +19
-4
lines changed Expand file tree Collapse file tree 2 files changed +19
-4
lines changed Original file line number Diff line number Diff line change @@ -19,8 +19,7 @@ for_each_uint! { $ty $hide_docs =>
19
19
}
20
20
21
21
/// The error struct used by [`BitFlags::from_bits`]
22
- /// and the [`TryFrom`] implementation`
23
- /// for invalid values.
22
+ /// and the [`TryFrom`] implementation for invalid values.
24
23
///
25
24
/// Note that the implementation of [`std::error::Error`]
26
25
/// for this type is gated on the `std` feature flag.
Original file line number Diff line number Diff line change @@ -792,7 +792,23 @@ where
792
792
}
793
793
}
794
794
795
- /// Returns an iterator that yields each set flag
795
+ /// Iterate over the `BitFlags`.
796
+ ///
797
+ /// ```
798
+ /// # use enumflags2::{bitflags, make_bitflags};
799
+ /// # #[bitflags]
800
+ /// # #[derive(Clone, Copy, PartialEq, Debug)]
801
+ /// # #[repr(u8)]
802
+ /// # enum MyFlag {
803
+ /// # A = 1 << 0,
804
+ /// # B = 1 << 1,
805
+ /// # C = 1 << 2,
806
+ /// # }
807
+ /// let flags = make_bitflags!(MyFlag::{A | C});
808
+ ///
809
+ /// flags.iter()
810
+ /// .for_each(|flag| println!("{:?}", flag));
811
+ /// ```
796
812
#[ inline]
797
813
pub fn iter ( self ) -> Iter < T > {
798
814
Iter { rest : self }
@@ -808,7 +824,7 @@ impl<T: BitFlag> IntoIterator for BitFlags<T> {
808
824
}
809
825
}
810
826
811
- /// Iterator that yields each set flag .
827
+ /// Iterator that yields each flag set in a `BitFlags` .
812
828
#[ derive( Clone , Debug ) ]
813
829
pub struct Iter < T : BitFlag > {
814
830
rest : BitFlags < T > ,
You can’t perform that action at this time.
0 commit comments