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

相关推荐
踩着两条虫6 小时前
「AI + 低代码」的可视化设计器
开发语言·前端·低代码·设计模式·架构
JoneBB6 小时前
ABAP Webservice连接
运维·开发语言·数据库·学习
Spider Cat 蜘蛛猫6 小时前
Springboot SSO系统设计文档
java·spring boot·后端
即使再小的船也能远航6 小时前
【Python】安装
开发语言·python
Irissgwe6 小时前
类与对象(三)
开发语言·c++·类和对象·友元
雪度娃娃7 小时前
转向现代C++——优先选用nullptr而不是0和NULL
开发语言·c++
zyk_computer7 小时前
AI 时代,或许 Rust 比 Python 更合适
人工智能·后端·python·ai·rust·ai编程·vibe coding
萌新小码农‍7 小时前
python装饰器
开发语言·前端·python
KK溜了溜了7 小时前
Python从入门到精通
服务器·开发语言·python
雨辰AI8 小时前
SpringBoot3 项目国产化改造完整流程|从 MySQL 到人大金仓落地
java·数据库·后端·mysql·政务