We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
set
BitFlags
1 parent bf161cf commit dc3c613Copy full SHA for dc3c613
src/lib.rs
@@ -655,12 +655,20 @@ where
655
*self &= !other.into();
656
}
657
658
+ /// Inserts if `cond` holds, else removes
659
+ #[inline(always)]
660
+ pub fn set<B: Into<BitFlags<T>>>(&mut self, other: B, cond: bool) {
661
+ if cond {
662
+ self.insert(other);
663
+ } else {
664
+ self.remove(other);
665
+ }
666
667
+
668
/// Returns an iterator that yields each set flag
669
#[inline]
670
pub fn iter(self) -> Iter<T> {
- Iter {
- rest: self,
- }
671
+ Iter { rest: self }
672
673
674
0 commit comments