用货物安装未注册的箱子
Install unregistered crate with cargo
我有一个未在 crates.io 上注册的箱子 (https://github.com/wilbertom/bichannels)。我想将它作为依赖项添加到我当前的箱子中。我试过进入它的目录(放在外箱内)和 运行 cargo install
,但这不起作用,而是给出了这个错误:
error: no packages found with binaries or examples
看来只能安装二进制 crate,但如何将库 crate 添加到我的依赖项中?我试过添加:
bichannels = "*"
给我的 Cargo.toml 但这只是说这个包裹不在 crates.io.
有两种选择:
将此添加到 Cargo.toml:
[dependencies]
"bichannels" = {git = "https://github.com/wilbertom/bichannels"}
或git在本地克隆库并使用:
[dependencies]
"bichannels" = {path = "<roor_dir_of_your_clone>"}
我有一个未在 crates.io 上注册的箱子 (https://github.com/wilbertom/bichannels)。我想将它作为依赖项添加到我当前的箱子中。我试过进入它的目录(放在外箱内)和 运行 cargo install
,但这不起作用,而是给出了这个错误:
error: no packages found with binaries or examples
看来只能安装二进制 crate,但如何将库 crate 添加到我的依赖项中?我试过添加:
bichannels = "*"
给我的 Cargo.toml 但这只是说这个包裹不在 crates.io.
有两种选择:
将此添加到 Cargo.toml:
[dependencies]
"bichannels" = {git = "https://github.com/wilbertom/bichannels"}
或git在本地克隆库并使用:
[dependencies]
"bichannels" = {path = "<roor_dir_of_your_clone>"}