From ba46f309bfc0364b019344971c19ef4dd1349f8b Mon Sep 17 00:00:00 2001 From: Lukas Kalbertodt Date: Wed, 18 Oct 2023 20:50:09 +0200 Subject: [PATCH] Add hint to `IntegerLit::value` docs CC #15 --- src/integer/mod.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/integer/mod.rs b/src/integer/mod.rs index 2a8d3a2..cecd79d 100644 --- a/src/integer/mod.rs +++ b/src/integer/mod.rs @@ -60,6 +60,13 @@ impl IntegerLit { /// method**. This means `N` does not need to match the type suffix! /// /// Returns `None` if the literal overflows `N`. + /// + /// Hint: `u128` can represent all possible values integer literal values, + /// as there are no negative literals (see type docs). Thus you can, for + /// example, safely use `lit.value::().to_string()` to get a decimal + /// string. (Technically, Rust integer literals can represent arbitrarily + /// large numbers, but those would be rejected at a later stage by the Rust + /// compiler). pub fn value(&self) -> Option { let base = N::from_small_number(self.base.value());