6个版本
| 0.1.5 | 2022年12月26日 |
|---|---|
| 0.1.4 | 2022年12月20日 |
| 0.1.3 | 2022年4月26日 |
| 0.1.2 | 2021年11月7日 |
| 0.1.1 | 2021年2月6日 |
#283 in 内存管理
11KB
127 行
smallest-uint
给定一个无符号的类型级别整数,提供访问能够表示该整数值(或该值以下的所有值)的最小原始无符号整数类型(u8、u16等)。
这在构建数据结构时最小化内存使用非常有用。
此crate只依赖于core,因此可以在no_std环境中使用。
示例
use smallest_uint::{SmallestUIntFor, SmallestUIntUpTo};
use std::any::TypeId;
use typenum::U65536;
assert_eq!(TypeId::of::<SmallestUIntUpTo<U65536>>(), TypeId::of::<u16>());
assert_eq!(TypeId::of::<SmallestUIntFor<U65536>>(), TypeId::of::<u32>());
crate功能
如果启用了功能u128,此crate将使用u128类型。此功能默认启用。
依赖项
~215–305KB