Skip to content

Commit ad78235

Browse files
authored
Add missing num_integer re-export, docs (#22)
1 parent 8a1389e commit ad78235

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "fixed-bigint"
3-
version = "0.1.6"
3+
version = "0.1.7"
44
authors = ["kaidokert <kaidokert@gmail.com>"]
55
documentation = "https://docs.rs/fixed-bigint"
66
edition = "2018"

src/lib.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
//! A fixed-size big integer implementation, unsigned only.
1818
//! [FixedUInt] implements a [num_traits::PrimInt] trait, mimicking built-in `u8`, `u16` and `u32` types.
19+
//! [num_integer::Integer] is also implemented.
1920
//!
2021
//! Simple usage example:
2122
//! ```
@@ -25,10 +26,24 @@
2526
//! assert_eq!( a + a , 400u16.into() );
2627
//! assert_eq!( a * &100u8.into(), 20000u16.into() )
2728
//! ```
29+
//!
30+
//! Use Integer trait:
31+
//! ```
32+
//! use fixed_bigint::FixedUInt;
33+
//! use num_integer::Integer;
34+
//!
35+
//! let a : FixedUInt<u8,2> = 400u16.into();
36+
//! assert_eq!( a.is_multiple_of( &(8u8.into()) ) , true );
37+
//! assert_eq!( a.gcd( &(300u16.into() )) , 100u8.into() );
38+
//! assert_eq!( a.lcm( &(440u16.into() )) , 4400u16.into() );
39+
//! ```
2840
2941
/// Re-export num_traits crate
3042
pub use num_traits;
3143

44+
/// Re-export num_integer crate
45+
pub use num_integer;
46+
3247
/// Fixed-size big integer implementation
3348
pub mod fixeduint;
3449

0 commit comments

Comments
 (0)