Skip to content

Commit bc5381e

Browse files
committed
Rename to_flag -> exactly_one
`to_flag` doesn't convey the fallibility, and there's already precedent for `exactly_one`.
1 parent e6a3127 commit bc5381e

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/lib.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -583,9 +583,11 @@ where
583583
self.val.count_ones() as usize
584584
}
585585

586-
/// Returns the flag that is set if there is exactly one.
586+
/// 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).
587589
#[inline(always)]
588-
pub fn to_flag(self) -> Option<T> {
590+
pub fn exactly_one(self) -> Option<T> {
589591
if self.val.is_power_of_two() {
590592
Some(unsafe { core::mem::transmute_copy(&self.val) })
591593
} else {

0 commit comments

Comments
 (0)