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 =>
1919}
2020
2121/// 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.
2423///
2524/// Note that the implementation of [`std::error::Error`]
2625/// 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
792792 }
793793 }
794794
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+ /// ```
796812 #[ inline]
797813 pub fn iter ( self ) -> Iter < T > {
798814 Iter { rest : self }
@@ -808,7 +824,7 @@ impl<T: BitFlag> IntoIterator for BitFlags<T> {
808824 }
809825}
810826
811- /// Iterator that yields each set flag .
827+ /// Iterator that yields each flag set in a `BitFlags` .
812828#[ derive( Clone , Debug ) ]
813829pub struct Iter < T : BitFlag > {
814830 rest : BitFlags < T > ,
You can’t perform that action at this time.
0 commit comments