Rust cargo常用命令
Rust cargo常用命令
# 添加如下镜像源
[source.crates-io]
replace-with = 'rsproxy-sparse'
[source.rsproxy]
registry = "https://rsproxy.cn/crates.io-index"
[source.rsproxy-sparse]
registry = "sparse+https://rsproxy.cn/index/"
[registries.rsproxy]
index = "https://rsproxy.cn/crates.io-index"
[net]
git-fetch-with-cli = true
创建新项目
构建项目
运行项目
检查项目,但不构建可执行文件
运行项目的测试
发布项目
更新依赖
查看项目依赖关系树
创建新的库项目
cargo new --lib my_library
文档生成
减少rust编译后程序体积
编译release版本
strip 命令
strip -s target/release/testGui
优化等级
通过修改默认优化等级方式减少体积,以cpu换空间,如果不是必要,建议不要改
在Cargo.toml中新增下面配置 …
Read More
Rust actix-web框架
Github
https://github.com/actix/actix-web
官方文档
https://actix.rs/docs/getting-started
设置国内镜像
cd ~/.cargo
创建config文件
vim config
添加如下镜像源
[source.crates-io]
replace-with = 'rsproxy-sparse'
[source.rsproxy]
registry = "https://rsproxy.cn/crates.io-index"
[source.rsproxy-sparse]
registry …
Read More
Rust Druid桌面应用框架
Github
https://github.com/linebender/druid
管方文档
https://docs.rs/druid/latest/druid/
简介
Druid 是一个用于构建现代、高性能、跨平台桌面应用的 Rust 库。以下是一些 Druid 框架的 …
Read More
Rust安装及学习资料
Rust安装及学习资料
目录
官网
包管理
Rust 程序设计语言
通过例子学 Rust
在线运行
安装rustup
升级Rust
卸载Rust
创建项目
官网
https://www.rust-lang.org/zh-CN/
包管理
https://crates …
Read More
从字符串来浅谈Rust内存模型
最近我尝试在课设程序中引入了Rust,理由很简单——Rust是我心目中不可多得的在语言层面尝试改进内存安全与高性能的现代编程语言。不过这种尝试确实相当前卫,以至于让Rust对初学者显得不是那么友好。在这篇文章中,我将尝试通过 …
Read More