Я добавил зависимость rand
в свой проект:
[dependencies]
rand = "0.5"
В моем main.rs
у меня есть следующее:
extern crate rand;
pub mod foo;
use foo::Foo;
fn main() {
println!("{:#?}", Foo::new());
}
А в файле foo.rs
:
use rand::Rng;
#[derive(Debug)]
pub struct Foo { bar: bool }
impl Foo {
pub fn new() -> Foo {
Foo { bar: rand::thread_rng().gen_bool(0.5) }
}
}
И когда я пытаюсь его скомпилировать, у меня появляется следующая ошибка:
error[E0658]: access to extern crates through prelude is experimental (see issue #44660)
--> src\foo.rs:11:18
|
11 | bar: rand::thread_rng().gen_bool(0.5)
| ^^^^
Как я могу использовать внешние ящики из модулей?