在 Rust 中使用位数组的正确方法是什么?
What is the proper way to use bit array in Rust?
我需要一个 class,其功能等同于 C++ 中的 vector<bool>
。 The Rust documentation tells about BitVec
, but use std::collections::BitVec
causes Unresolved import error during compiling. According to a pull request、BitVec
已被删除。有合适的替代品吗?
标准库中不存在专用的位向量,并且 Vec<bool>
不像 C++ 的 vector<bool>
那样专门化。 Rust 提倡使用外部 crate,而不是构建一个庞大的标准库。这个用例的实际箱子是 bit-vec
。
您似乎找到了旧标准库文档的 link:https://doc.rust-lang.org/1.2.0/std/collections/struct.BitVec.html
。注意url中的1.2.0
!当前的 Rust 版本是 1.25(截至 2018 年 4 月),这意味着 1.2
已经有两年多了。除此之外,BitVec
在 1.2 文档中被标记为不稳定;后来被删除了。
我需要一个 class,其功能等同于 C++ 中的 vector<bool>
。 The Rust documentation tells about BitVec
, but use std::collections::BitVec
causes Unresolved import error during compiling. According to a pull request、BitVec
已被删除。有合适的替代品吗?
标准库中不存在专用的位向量,并且 Vec<bool>
不像 C++ 的 vector<bool>
那样专门化。 Rust 提倡使用外部 crate,而不是构建一个庞大的标准库。这个用例的实际箱子是 bit-vec
。
您似乎找到了旧标准库文档的 link:https://doc.rust-lang.org/1.2.0/std/collections/struct.BitVec.html
。注意url中的1.2.0
!当前的 Rust 版本是 1.25(截至 2018 年 4 月),这意味着 1.2
已经有两年多了。除此之外,BitVec
在 1.2 文档中被标记为不稳定;后来被删除了。