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.
1 parent e6a3127 commit bc5381eCopy full SHA for bc5381e
src/lib.rs
@@ -583,9 +583,11 @@ where
583
self.val.count_ones() as usize
584
}
585
586
- /// Returns the flag that is set if there is exactly one.
+ /// If exactly one flag is set, the flag is returned. Otherwise, returns `None`.
587
+ ///
588
+ /// See also [`Itertools::exactly_one`](https://docs.rs/itertools/latest/itertools/trait.Itertools.html#method.exactly_one).
589
#[inline(always)]
- pub fn to_flag(self) -> Option<T> {
590
+ pub fn exactly_one(self) -> Option<T> {
591
if self.val.is_power_of_two() {
592
Some(unsafe { core::mem::transmute_copy(&self.val) })
593
} else {
0 commit comments