diff --git a/docs/cargo.html b/docs/cargo.html index e4520b8e..b1187852 100644 --- a/docs/cargo.html +++ b/docs/cargo.html @@ -42,7 +42,7 @@
此快速参考备忘清单 Cargo 提供了编译 Rust 常用命令和示例
$ curl -sSf https://static.rust-lang.org/rustup.sh | sh
@@ -102,10 +102,28 @@
:- | :- |
---|---|
cargo version | 显示版本信息以确认 Cargo 已安装 |
cargo new | 创建一个新项目 |
cargo test | 在项目中运行单元测试 |
cargo check | 快速编译项目,无需生成二进制文件来检查错误 |
cargo fmt | 自动格式化代码 |
cargo build | 编译一个项目 |
cargo run | 一步编译和运行项目 |
cargo clippy --all-targets -- --D warnings | Linter 检查错误 |
cargo tarpaulin --ignore-tests | 检查代码覆盖率 |
$ touch ~/.cargo/config # 添加配置文件
+$ vim ~/.cargo/config # 编辑配置文件
+
+配置文件 config
内容
[source.crates-io]
+registry = "https://github.com/rust-lang/crates.io-index"
+replace-with = 'tuna' # 👈 如果需要提交包注释配置源
+
+[source.tuna]
+registry = "https://mirrors.tuna.tsinghua.edu.cn/git/crates.io-index.git"
+# registry = "git://mirrors.ustc.edu.cn/crates.io-index"
+
+💥 注意切换源需要删除缓存目录
+$ rm -rf ~/.cargo/.package-cache # ⚠️ 删除缓存目录内容
+
$ cargo new hello_world --bin
+--bin
正在制作一个二进制程序--lib
正在创建一个库(lib)# `source` 表下,就是存储有关要更换的来源名称
[source]
-# 在`source` 表格之下的,可为一定数量的有关来源名称. 示例下面就# 定义了一个新源, 叫 `my-awesome-source`, 其内容来自本地 # `vendor`目录 ,其相对于包含`.cargo/config`文件的目录
+# 在`source` 表格之下的,可为一定数量的有关来源名称. 示例下面就,定义了一个新源, 叫 `my-awesome-source`,其内容来自本地,`vendor`目录 ,其相对于包含 `.cargo/config` 文件的目录
[source.my-awesome-source]
directory = "vendor"
@@ -212,7 +230,7 @@
# tag = "v1.0.1"
# rev = "313f44e8"
-# The crates.io 默认源 在"crates-io"名称下, 且在这里我们使用 `replace-with` 字段指明 默认源更换成"my-awesome-source"源
+# crates.io 默认源 在"crates-io"名称下,且在这里我们使用 `replace-with` 字段指明 默认源更换成"my-awesome-source"源
[source.crates-io]
replace-with = "my-awesome-source"
@@ -230,7 +248,7 @@
directory = "path/to/vendor"
-更换源的配置通过完成 .cargo/config
,下面为全套可用字段是
更换源的配置通过完成 .cargo/config
,上面是全套可用字段
将一个或所有软件包更新到特定版本
更新包考虑过时
+$ yum -y upgrade
+
+更新包考虑过时,只升级所有包,不升级软件和系统内核
从本地文件、http 或 ftp 安装包
-$ yum localinstall abc-1-1.i686.rpm
-
-从本地目录安装 abc 包
-$ yum localinstall http://myrepo/abc-1-1.i686.rpm
+# 从本地文件、http 或 ftp 安装包
+$ yum localinstall abc-1-1.i686.rpm
+# 从本地目录安装 abc 包
+$ yum localinstall http://myrepo/abc-1-1.i686.rpm
+
从 FTP 站点安装 abc
downgrade将软件包降级到早期版本
@@ -253,6 +255,14 @@
yumdb检查或更改 yum 数据库
+ yumdownloader# 使用本地源离线安装 net-tools 工具包
+$ yumdownloader net-tools.x86_64
+# 使用 –destdir 参数设置下载的目标目录
+$ yumdownloader net-tools.x86_64 --destdir=/usr/local/bin/
+# 使用 –resolve 参数解决依赖关系并下载所需的安装包
+$ yumdownloader net-tools.x86_64 --resolve --destdir=/usr/local/bin/
+
+
从 repo 下载一个包到当前目录
yum --disableplugin=langpacks info vsftpd
diff --git a/style/style.css b/style/style.css
index eae21db2..a4b568e4 100644
--- a/style/style.css
+++ b/style/style.css
@@ -735,6 +735,10 @@ body:not(.home) .h2wrap-body > .wrap:hover .h3wrap > h3 a::after {
border-radius: 0 0 0.5rem 0.5rem;
}
+.wrap-header.h3wrap > .wrap-body :not(:first-child):last-child {
+ border-radius: 0 0 0.5rem 0.5rem;
+}
+
.wrap-header.h3wrap > .wrap-body {
z-index: 0;
display: flex;