How to import a crate dependency when the library name is different from the package name?
问题 I have a crate that is imported straight off of GitHub, as per Cargo's documentation: [dependencies] libfoo = { git = "ssh://git@github.com/me/libfoo", branch = "dev" } [lib] path = "src/rust/lib.rs" name = "myprj" crate-type = ["cdylib"] Running cargo build works fine here, Cargo fetches libfoo and builds it in the ~/.cargo directory. When I try to use (import) it in lib.rs : extern crate libfoo; //also tried foo Cargo chokes: error[E0463]: can't find crate for `libfoo` --> src/rust/lib.rs:1