rust 使用记录

rust 使用记录

安装

参考 rust install

sh 复制代码
sudo apt install -y curl
# 安装
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
# 加载环境变量
source $HOME/.cargo/env
# 查看版本
rustc --version
rustc -V

# 更新Rust
rustup update

# 卸载
# rustup self uninstall

包管理

rustc:用于 Rust 编程语言的 Rust 编译器

cargo 提供了一系列的工具,从项目的建立、构建到测试、运行直至部署,为 Rust 项目的管理提供尽可能完整的手段, 与 Rust 语言及其编译器 rustc 紧密结合

sh 复制代码
sudo apt install cargo
# 创建项目
# cargo new world_hello
# --bin 默认, 可运行的项目
# --lib 依赖库项目

# 有两种方式可以运行项目:
cargo run
# 2) 手动编译和运行项目
cargo build
./target/debug/world_hello

# 默认是debug,代码的编译速度会非常快, 运行速度就慢,编译器不会做任何的优化
cargo run --release

镜像源

A high speed crates.io mirror

相关推荐
xiaoyaohou111 天前
023、数据增强改进(二):自适应数据增强与AutoAugment策略
开发语言·python
鬼圣1 天前
Python 上下文管理器
开发语言·python
星空椰1 天前
JavaScript 基础进阶:分支、循环与数组实战总结
开发语言·javascript·ecmascript
yong99901 天前
IHAOAVOA:天鹰优化算法与非洲秃鹫优化算法的混合算法(Matlab实现)
开发语言·算法·matlab
t***5441 天前
有哪些常见的架构设计模式在现代C++中应用
开发语言·c++
IT_陈寒1 天前
Redis的内存溢出坑把我整懵了,分享这个血泪教训
前端·人工智能·后端
人间打气筒(Ada)1 天前
「码动四季·开源同行」python语言:用户交互
开发语言·python·基本数据类型·注释·变量·常量·文件头
kaikaile19951 天前
C# 文件编码转换工具
开发语言·c#
沐雪轻挽萤1 天前
10. C++17新特性-保证的拷贝消除 (Guaranteed Copy Elision / RVO)
开发语言·c++
Jasper_o1 天前
MassTransit OutBox 不发送消息问题
后端·.net