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

相关推荐
爱吃牛肉的大老虎38 分钟前
网络传输架构之GraphQL讲解
后端·架构·graphql
稚辉君.MCA_P8_Java3 小时前
Gemini永久会员 containerd部署java项目 kubernetes集群
后端·spring cloud·云原生·容器·kubernetes
yihuiComeOn3 小时前
[源码系列:手写Spring] AOP第二节:JDK动态代理 - 当AOP遇见动态代理的浪漫邂逅
java·后端·spring
p***h6434 小时前
JavaScript在Node.js中的异步编程
开发语言·javascript·node.js
散峰而望4 小时前
C++数组(二)(算法竞赛)
开发语言·c++·算法·github
Porunarufu4 小时前
Java·关于List
java·开发语言
e***71674 小时前
Spring Boot项目接收前端参数的11种方式
前端·spring boot·后端
程序猿小蒜4 小时前
基于springboot的的学生干部管理系统开发与设计
java·前端·spring boot·后端·spring
子不语1804 小时前
Python——函数
开发语言·python
q***56385 小时前
Spring容器初始化扩展点:ApplicationContextInitializer
java·后端·spring