Rust开发环境搭建与基础命令
发布于
# rust
Rust入门
常用命令
cargo命令
cargo build
更新指定的依赖项到最新兼容版本
cargo update -p <dependency.name>
如果你想对不同的模块设置不同的日志等级,可以使用逗号分隔的格式
RUST_LOG=my_crate=debug,cargo=info cargo run
交叉编译
安装cross
cargo install cross
编译命令(区分运行环境)
cross build --target=aarch64-unknown-linux-gnu --release
cross build --target=x86_64-unknown-linux-gnu --release
更改依赖至本地
# 更新前
[dependencies]
bernard = { git = "https://github.com/m-rots/bernard-rs", branch = "main" }
# 更新后
[dependencies]
bernard = { path = "/Users/shizitoumengchong/coding/rust/github" }
这样就可以在本地修改代码后更新依赖调试