From ff5a1fbbba6e71713e8503ab5e35ff5e8cebedf6 Mon Sep 17 00:00:00 2001 From: Corwin Date: Sat, 6 Aug 2022 19:04:40 +0100 Subject: [PATCH] add an example to the new number function --- agb-fixnum/src/lib.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/agb-fixnum/src/lib.rs b/agb-fixnum/src/lib.rs index be592af9..47036f28 100644 --- a/agb-fixnum/src/lib.rs +++ b/agb-fixnum/src/lib.rs @@ -301,6 +301,16 @@ impl Num { /// Attempts to perform the conversion between two integer types and between /// two different fractional precisions + /// ``` + /// # use agb_fixnum::*; + /// let a: Num = 1.into(); + /// let b: Option> = a.try_change_base(); + /// assert_eq!(b, Some(1.into())); + /// + /// let a: Num = 18.into(); + /// let b: Option> = a.try_change_base(); + /// assert_eq!(b, None); + /// ``` pub fn try_change_base, const M: usize>( self, ) -> Option> {