I need a class with functionality equal to vector<bool>
in C++. The Rust documentation tells about BitVec
, but use std::collections::BitVec
causes Unresolved import error during compiling. According to a pull request, BitVec
has been removed. Is there any adequate replacement for it?
相关问题
- Share Arc between closures
- Function references: expected bound lifetime param
- Pattern matching on slices
- How can I iteratively call Sha256::digest, passing
- Destructure a vector into variables and give away
相关文章
- How can I convert a f64 to f32 and get the closest
- What is a good way of cleaning up after a unit tes
- How can I unpack (destructure) elements from a vec
- How to import macros in Rust?
- How to get struct field names in Rust? [duplicate]
- Confusion between [T] and &[T]
- How do I initialize an opaque C struct when using
- What's the most idiomatic way to test two Opti
There does not exist a dedicated bit-vector in the standard library and
Vec<bool>
is not specialized like C++'svector<bool>
. Rust advocates the use of external crates instead of building a huge standard library. The de-facto crate for this use case isbit-vec
.You appear to have found a link to an old standard library documentation:
https://doc.rust-lang.org/1.2.0/std/collections/struct.BitVec.html
. Note the1.2.0
in the url! The current version of Rust is 1.25 (as of April 2018), which means that1.2
is already more than two years old. Apart from that,BitVec
is marked as unstable in the 1.2 docs; it was removed later.