From ad78235a8fae37300ce9870d2a6384b41511a92e Mon Sep 17 00:00:00 2001 From: Kert Date: Tue, 12 Oct 2021 08:50:04 -0700 Subject: [PATCH] Add missing num_integer re-export, docs (#22) --- Cargo.toml | 2 +- src/lib.rs | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index d3b00c6..77308bc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "fixed-bigint" -version = "0.1.6" +version = "0.1.7" authors = ["kaidokert "] documentation = "https://docs.rs/fixed-bigint" edition = "2018" diff --git a/src/lib.rs b/src/lib.rs index 222eea6..c8999db 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -16,6 +16,7 @@ //! A fixed-size big integer implementation, unsigned only. //! [FixedUInt] implements a [num_traits::PrimInt] trait, mimicking built-in `u8`, `u16` and `u32` types. +//! [num_integer::Integer] is also implemented. //! //! Simple usage example: //! ``` @@ -25,10 +26,24 @@ //! assert_eq!( a + a , 400u16.into() ); //! assert_eq!( a * &100u8.into(), 20000u16.into() ) //! ``` +//! +//! Use Integer trait: +//! ``` +//! use fixed_bigint::FixedUInt; +//! use num_integer::Integer; +//! +//! let a : FixedUInt = 400u16.into(); +//! assert_eq!( a.is_multiple_of( &(8u8.into()) ) , true ); +//! assert_eq!( a.gcd( &(300u16.into() )) , 100u8.into() ); +//! assert_eq!( a.lcm( &(440u16.into() )) , 4400u16.into() ); +//! ``` /// Re-export num_traits crate pub use num_traits; +/// Re-export num_integer crate +pub use num_integer; + /// Fixed-size big integer implementation pub mod fixeduint;