I am currently learning Rust, and for that purpose I wanted to create my own crate and use it. However, Rust can't find this crate.
I have the following file structure:
├───minimal
│ ├───Cargo.toml
│ └───src
│ └───main.rs
└───util
└───win
├───Cargo.toml
└───src
└───lib.rs
In folder minimal I have my main project. It looks like this:
Cargo.toml
[package]
name = "minimal"
version = "0.1.0"
[dependecies]
win = { path = "../util/win"}
main.rs
extern crate win; // ERROR: "Can't find crate for 'win' rustc(E0463)"
fn main() {
println!("Hello, World!");
}
My library in folder win looks like this:
File Cargo.toml
[package]
name = "win"
version = "0.1.0"
File lib.rs
pub type TestType = String;
My first assumption was that I somehow had a mistake in specifying the path in the dependency of the Cargo.toml file. So I tried to wiggle it around a bit, but it does not seem to work.
Rust reports
can't find crate for 'win' rustc(E0463)
I feel like I am making a very basic error here, however, when looking at similar questions (e.g., How do I "use" or import a local Rust file?) I can't seem to find it.
cargo
to build/run this right? I.e. Runningcargo run
in the minimal directory – Voguecargo run
to run this, yes.I installed rust from here: rust-lang.org/tools/install and I run it from visual studio code in windows 10. (I get the same error if I use the cmd-prompt directly.) Strange that it works out of the box for you. – Ctenoid