#integer-value #bitset #allocation-free #small-values

no-std smallbitset

此crate提供一系列能够存储小整数值的分配免费集合

10个版本 (6个破坏性版本)

0.7.1 2023年5月11日
0.7.0 2023年5月11日
0.6.1 2023年1月26日
0.5.1 2021年12月13日
0.1.0 2021年2月4日

#374 in 数据结构

Download history 4992/week @ 2024-03-14 4322/week @ 2024-03-21 5190/week @ 2024-03-28 3788/week @ 2024-04-04 4200/week @ 2024-04-11 4383/week @ 2024-04-18 3300/week @ 2024-04-25 2686/week @ 2024-05-02 3275/week @ 2024-05-09 3241/week @ 2024-05-16 2555/week @ 2024-05-23 1511/week @ 2024-05-30 1286/week @ 2024-06-06 1240/week @ 2024-06-13 905/week @ 2024-06-20 742/week @ 2024-06-27

4,544 每月下载量
用于 ddo

MIT 许可证

57KB
1K SLoC

smallbitset

Crates.io Documentation Build Tests codecov Quality GitHub

此crate提供一系列能够存储小整数值的分配免费整数集合。

用法

在您的 Cargo.toml 中,您应该在依赖项部分添加以下行。

[dependencies]
smallbitset = "0.6.0"

然后在您的main代码中,您将简单地使用以下所示的可用的集合之一

use smallbitset::Set32;

fn main() {
	let mut x = Set32::empty();

	x = x.insert(1);
	assert_eq!(Set32::singleton(1), x);
	assert!(x.contains(1));
	
	// and so on ... check the online documentation for the complete api details
	
}

依赖项

~150KB