25 个版本
| 0.9.5 | 2022 年 11 月 29 日 |
|---|---|
| 0.9.3 | 2022 年 2 月 4 日 |
| 0.9.1 | 2021 年 6 月 30 日 |
| 0.9.0 | 2021 年 1 月 5 日 |
| 0.1.0 | 2017 年 12 月 29 日 |
#25 在 算法 中排名
625,255 每月下载量
在 2,505 个 crate 中使用 (128 个直接使用)
53KB
1.5K SLoC
Uint
描述
提供构建不进行分配的大无符号整数类型(基于堆栈,固定位长度)的设施。如果您想使用预定义的 U128、U256 或 U512 类型,请查看 primitive-types 或 ethereum-types crate。
对提供的较大无符号整数类型的关注重点是性能和跨平台可用性。支持与内置原始整数类型非常相似的 API。
用法
在您的 Cargo.toml 中粘贴
uint = "0.8"
导入宏
use uint::construct_uint;
如果您在主文件中使用 pre-edition Rust
#[macro_use]
extern crate uint;
如下构造您自己的大无符号整数类型。
// U1024 with 1024 bits consisting of 16 x 64-bit words
construct_uint! {
pub struct U1024(16);
}
测试
基本测试
cargo test --release
基本测试 + 属性测试
cargo test --release --features=quickcheck
基准测试
cargo bench
模糊测试
查看模糊 README.md
crate 功能
std:使用 Rust 的标准库。- 启用
byteorder/std、rustc-hex/std - 默认启用。
- 启用
quickcheck:启用快速检查样式的属性测试- 与
cargo test --release --features=quickcheck一起使用。
- 与
arbitrary:允许从随机非结构化输入创建一个uint对象,用于与使用arbitrarycrate 的模糊器一起使用。- 默认禁用。
依赖关系
~155–400KB