rust编程世界
- 下载
- win https://www.rust-lang.org/zh-CN/tools/install
win下需安装 Visual Studio 2013以上版本,然后执行rustup-init.exe,选择1 - linux
curl --proto '=https' --tlsv1.2 https://sh.rustup.rs -sSf | sh
选择1source "$HOME/.cargo/env"
立即生效 - 命令
rustc -V
版本rustup update
升级rustup self uninstall
卸载cargo -V
包管理rustup doc
本地文档 - 镜像
使用国内镜像,在C:\Users\yoby.cargo\config.toml创建文件,文件名就是”config”,而不是”.config”!!![source.crates-io] replace-with = 'aliyun' [source.aliyun] registry = "sparse+https://mirrors.aliyun.com/crates.io-index/"
- vscode rls 和 Native Debug 两个扩展,演示
cargo new hello cd hello cargo build 生成 cargo build --release 正式版生成 cargo run cargo check 检测
- win https://www.rust-lang.org/zh-CN/tools/install
- hello world
fn greet_world() {
let southern_germany = "Grüß Gott!";
let chinese = "世界,你好";
let english = "World, hello";
let regions = [southern_germany, chinese, english];
for region in regions {
println!("{}", region);
}
}
fn main() {
greet_world();
}
- 常见库
cargo install slint-lsp
slint语言cargo install cargo-generate
ratatui
作者:Yoby 创建时间:2020-07-25 00:08
最后编辑:Yoby 更新时间:2025-07-05 02:08
最后编辑:Yoby 更新时间:2025-07-05 02:08