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 e286f25 commit b75351eCopy full SHA for b75351e
library/core/src/cmp.rs
@@ -1406,6 +1406,22 @@ mod impls {
1406
_ => unsafe { unreachable_unchecked() },
1407
}
1408
1409
+
1410
+ #[inline]
1411
+ fn min(self, other: bool) -> bool {
1412
+ self & other
1413
+ }
1414
1415
1416
+ fn max(self, other: bool) -> bool {
1417
+ self | other
1418
1419
1420
1421
+ fn clamp(self, min: bool, max: bool) -> bool {
1422
+ assert!(min <= max);
1423
+ self.max(min).min(max)
1424
1425
1426
1427
ord_impl! { char usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 }
0 commit comments