gpt4 book ai didi

rust - 如何停止在 Rust 中重新编译 extern crate

转载 作者:行者123 更新时间:2023-11-29 08:32:38 26 4
gpt4 key购买 nike

我对某些 SDK 有本地依赖性。我利用

extern crate local_sdk; 
use local_sdk::foo;

在我的实现中使用 local_sdk

我正在利用 cargo build 。构建时,日志会在某个阶段打印以下内容 -

Compiling local_sdk v0.1.0 (file:///project/project-core/sdk/rust)

即使我之前已经编译了 local_sdk,也会发生这种情况。如何防止重新编译 local_sdk ?它消耗了一些重要的时间。

我的 Cargo.toml 的内容:

[package]
name = "service"
version = "0.1.0"
authors = ["Rajeev"]

[dependencies]
local_sdk = { path = "../../sdk/rust" }

local_sdk 具有以下 Cargo.toml:

[package]
name = "local_sdk"
version = "0.1.0"
authors = ["Rajeev"]

[dependencies]
hex = "0.3"
protobuf="2.0"
rand = "0.4.2"
zmq = { git = "https://github.com/erickt/rust-zmq", branch = "release/v0.8" }
uuid = { version = "0.5", features = ["v4"] }
log = "0.3"
libc = "0.2"
ctrlc = { version = "3.0", features = ["termination"] }

[dev-dependencies]
env_logger = "0.3"

[build-dependencies]
cc = "1.0"
glob = "0.2"

最佳答案

假设您正在使用它,有 an issue with RLS that was causing unnecessary rebuilds.

此问题已修复,要获取最新版本的 RLS,请使用

$ rustup update

关于rust - 如何停止在 Rust 中重新编译 extern crate,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50734058/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com