From 9a80ab7741f889f91853732b6351ee67b87364f7 Mon Sep 17 00:00:00 2001 From: nicoo Date: Tue, 21 Jul 2020 19:49:57 +0200 Subject: [PATCH] factor::numeric::DoubleInt: Document the DoubleWidth associated type --- src/uu/factor/src/numeric.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/uu/factor/src/numeric.rs b/src/uu/factor/src/numeric.rs index 031674ce1..6383809f8 100644 --- a/src/uu/factor/src/numeric.rs +++ b/src/uu/factor/src/numeric.rs @@ -217,11 +217,15 @@ pub(crate) trait Int: { fn as_u64(&self) -> u64; fn from_u64(n: u64) -> Self; + #[cfg(debug_assertions)] fn as_u128(&self) -> u128; } pub(crate) trait DoubleInt: Int { + /// An integer type with twice the width of `Self`. + /// In particular, multiplications (of `Int` values) can be performed in + /// `Self::DoubleWidth` without possibility of overflow. type DoubleWidth: Int; fn as_double_width(self) -> Self::DoubleWidth;