如何使用不稳定的std :: collections :: BitVec?

Gab*_*iro 2 bitvector rust data-structures

我正在尝试使用std::collections::BitVec,但是会生成此错误:

error[E0432]: unresolved import `std::collections::BitVec`
 --> src\main.rs:6:5
  |
6 | use std::collections::BitVec;
  |     ^^^^^^^^^^^^^^^^^^^^^^^^ no `BitVec` in `collections`
Run Code Online (Sandbox Code Playgroud)

#![feature(collections)]在main.rs的顶部使用,我的编译器版本为rustc 1.27.0-nightly (ac3c2288f 2018-04-18)。我想念什么?错误是说BitVec并不存在std::collections,但文档说这BitVec是不稳定的功能。

我的Cargo.toml看起来像:

[package]
name = "conways_game_of_life"
version = "0.1.0"
authors = ["Gabriel Carneiro <gabriel.carneiro97@live.com>"]

# [lib]
# crate-type = ["cdylib"]

[dependencies]
wasm-bindgen = "0.2"
rand = "0.4.2"
time = "*"
Run Code Online (Sandbox Code Playgroud)

使用不稳定的功能,我应该怎么做BitVec

Pet*_*all 5

您正在查看旧文档。BitVec在Rust 1.2中是不稳定的,但是您可以在Rust 1.3文档中看到它没有稳定,而是移到了自己的板条箱中

  • @GabrielCarneiro请不要在评论中添加“谢谢”。Upvote回答您喜欢的问题,这是Stack Overflow表示感谢的方式。 (2认同)