Debian Codegraph @

.cargo/vendor/num-bigint/README.md

raw
1 # num-bigint
2
3 [![crate](https://img.shields.io/crates/v/num-bigint.svg)](https://crates.io/crates/num-bigint)
4 [![documentation](https://docs.rs/num-bigint/badge.svg)](https://docs.rs/num-bigint)
5 [![minimum rustc 1.60](https://img.shields.io/badge/rustc-1.60+-red.svg)](https://rust-lang.github.io/rfcs/2495-min-rust-version.html)
6 [![build status](https://github.com/rust-num/num-bigint/workflows/master/badge.svg)](https://github.com/rust-num/num-bigint/actions)
7
8 Big integer types for Rust, `BigInt` and `BigUint`.
9
10 ## Usage
11
12 Add this to your `Cargo.toml`:
13
14 ```toml
15 [dependencies]
16 num-bigint = "0.4"
17 ```
18
19 ## Features
20
21 The `std` crate feature is enabled by default, and is mandatory before Rust
22 1.36 and the stabilized `alloc` crate. If you depend on `num-bigint` with
23 `default-features = false`, you must manually enable the `std` feature yourself
24 if your compiler is not new enough.
25
26 ### Random Generation
27
28 `num-bigint` supports the generation of random big integers when the `rand`
29 feature is enabled. To enable it include rand as
30
31 ```toml
32 rand = "0.8"
33 num-bigint = { version = "0.4", features = ["rand"] }
34 ```
35
36 Note that you must use the version of `rand` that `num-bigint` is compatible
37 with: `0.8`.
38
39 ## Releases
40
41 Release notes are available in [RELEASES.md](RELEASES.md).
42
43 ## Compatibility
44
45 The `num-bigint` crate is tested for rustc 1.60 and greater.
46
47 ## Alternatives
48
49 While `num-bigint` strives for good performance in pure Rust code, other
50 crates may offer better performance with different trade-offs. The following
51 table offers a brief comparison to a few alternatives.
52
53 | Crate | License | Min rustc | Implementation | Features |
54 | :--------------- | :------------- | :-------- | :------------- | :------- |
55 | **`num-bigint`** | MIT/Apache-2.0 | 1.60 | pure rust | dynamic width, number theoretical functions |
56 | [`awint`] | MIT/Apache-2.0 | 1.66 | pure rust | fixed width, heap or stack, concatenation macros |
57 | [`bnum`] | MIT/Apache-2.0 | 1.65 | pure rust | fixed width, parity with Rust primitives including floats |
58 | [`crypto-bigint`] | MIT/Apache-2.0 | 1.73 | pure rust | fixed width, stack only |
59 | [`ibig`] | MIT/Apache-2.0 | 1.49 | pure rust | dynamic width, number theoretical functions |
60 | [`rug`] | LGPL-3.0+ | 1.65 | bundles [GMP] via [`gmp-mpfr-sys`] | all the features of GMP, MPFR, and MPC |
61
62 [`awint`]: https://crates.io/crates/awint
63 [`bnum`]: https://crates.io/crates/bnum
64 [`crypto-bigint`]: https://crates.io/crates/crypto-bigint
65 [`ibig`]: https://crates.io/crates/ibig
66 [`rug`]: https://crates.io/crates/rug
67
68 [GMP]: https://gmplib.org/
69 [`gmp-mpfr-sys`]: https://crates.io/crates/gmp-mpfr-sys
70
71 ## License
72
73 Licensed under either of
74
75 * [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0)
76 * [MIT license](http://opensource.org/licenses/MIT)
77
78 at your option.
79
80 ### Contribution
81
82 Unless you explicitly state otherwise, any contribution intentionally submitted
83 for inclusion in the work by you, as defined in the Apache-2.0 license, shall be
84 dual licensed as above, without any additional terms or conditions.