Skip to content

Commit

Permalink
修缮
Browse files Browse the repository at this point in the history
  • Loading branch information
crack-dawn committed Aug 17, 2024
1 parent 413653f commit d7adff0
Show file tree
Hide file tree
Showing 65 changed files with 3,750 additions and 316 deletions.
15 changes: 8 additions & 7 deletions config/_default/params.toml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@

# FixIt 0.2.14 | 新增 在左上角或者右上角显示 GitHub 开源链接
[githubCorner] # 在左上角或者右上角显示 GitHub 开源链接
enable = false
enable = true
permalink = "https://github.com/crack-dawn/CTGU-Hugo-Blog.io"
title = "在 GitHub 上查看源代码"
position = "left" # ["left", "right"]
Expand Down Expand Up @@ -92,7 +92,7 @@
gravatarEmail = "" # Gravatar 邮箱,用于优先在主页显示的头像
avatarURL = "./my/hugo.svg" # 主页显示头像的 URL
title = "显而不易见" # 主页显示的网站标题 (支持 HTML 格式)
subtitle = "追求星辰大海,还是沉湎虚拟现实?" # 主页显示的网站副标题
subtitle = "同频共振" # 主页显示的网站副标题
typeit = true # 是否为副标题显示打字机动画
social = true # 是否显示社交账号
disclaimer = "" # 免责声明 (支持 HTML 格式)
Expand All @@ -101,6 +101,7 @@
paginate = 10 # 主页每页显示文章数量
# 作者的社交信息设置
[social]
RSS = false
GitHub = true
Bilibili = true
QQ = true
Expand Down Expand Up @@ -191,11 +192,11 @@
# FixIt 0.3.0 | 新增 页面标题配置
[page.heading]
# FixIt 0.3.6 | 新增 是否自动大写标题
capitalize = false
capitalize = true
# 配合 `markup.tableOfContents.ordered` 参数使用
[page.heading.number]
# 是否启用自动标题编号
enable = true
enable = false
[page.heading.number.format]
h1 = "{title}"
h2 = "{h2}.{title}"
Expand Down Expand Up @@ -266,6 +267,7 @@
# 文章页面的分享信息设置
[page.share]
enable = true
Baidu = true
Twitter = true
Facebook = true
Weibo = true
Expand All @@ -282,9 +284,8 @@
Pocket = false
Flipboard = false
Linkedin = false
Myspace = true
Blogger = true
Baidu = true
Myspace = false
Blogger = false
Odnoklassniki = false
Evernote = false
Skype = false
Expand Down
Binary file added content/posts/Rust/init.exe
Binary file not shown.
18 changes: 18 additions & 0 deletions content/posts/Rust/init.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
use std::collections::HashMap;

fn main() {
let res = tow_sum(vec![3,2,4], 6);
println!("{:?}", res);
}

fn tow_sum(nums:Vec<i32>, target: i32) -> Vec<i32> {
let mut map = HashMap::new();
for (i,v) in nums.iter().enumerate() {
let rem = target - v;
if let Some(j) = map.get(&rem) {
return vec![i as i32,*j];
}
map.insert(v, i as i32);
}
vec![]
}
273 changes: 273 additions & 0 deletions content/posts/Rust/rust安装使用.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,273 @@
---
title: rust安装使用
subtitle:
date: 2024-08-17T22:05:52+08:00
slug: ca1d32f
draft: false
comment: true
summary:
description: 在windows下安装rust。

keywords:

message: # 密码输入框预设提示
password: # 解锁密码

layout: # 布局归类:posts, archives, tags, categories等,文件分散在不同文件夹需要注明
archives:
tags: ['rust']
categories: ['rust']

author:
name:
link:
email:
avatar:
license:
repost:
enable: true
url:

weight: 0
hiddenFromHomePage: false
hiddenFromSearch: false
hiddenFromRss: false
hiddenFromRelated: false

resources:
- name: featured-image
src: featured-image.jpg
- name: featured-image-preview
src: featured-image-preview.jpg
toc: true
math: true
lightgallery: true

# See details front matter: https://fixit.lruihao.cn/documentation/content-management/introduction/#front-matter
---

<!--more-->

## windows下安装rust
### 1. 安装前准备:
+ [下载mingw64](https://github.com/niXman/mingw-builds-binaries/releases),下载后解压,`mingw64/bin/`目录加入环境变量
+ [下载rust_init.exe](https://www.rust-lang.org/tools/install)


+ Rust编译链工具安装目录修改:

Rust需要安装两个东西,一个是rustup,一个是cargo。所以你需要设置两个环境变量来分别指定他们的安装目录。

通过`RUSTUP_HOME`指定`rustup`的安装目录。
通过`CARGO_HOME`指定`cargo`的安装目录。

+ 切换清华镜像,网络加速
```text
配置加速安装地址: 直接从官方网站下载会很慢,改用国内镜像加速安装,设置以下`变量`,并一起加入`环境变量`:
RUSTUP_DIST_SERVER https://mirrors.tuna.tsinghua.edu.cn/rustup
RUSTUP_UPDATE_ROOT https://mirrors.tuna.tsinghua.edu.cn/rustup/rustup
```
+ 配置镜像配置库镜像
在“C:\Users\用户名\”下创建“.cargo”文件夹,在文件夹内创建“config”文件,如下图:
```text
[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
```
### 2. 安装开始:
+ 打开预先下载好的[rust_init.exe](https://www.rust-lang.org/tools/install) ,按照安装提示操作。
+ 在弹出的命令窗中 选择2,回车,然后输入`stable-x86_64-pc-windows-gnu`
```text
You can uninstall at any time with rustup self uninstall and
these changes will be reverted.
Current installation options:
default host triple: x86_64-pc-windows-msvc
default toolchain: stable (default)
profile: default
modify PATH variable: yes
1) Proceed with standard installation (default - just press enter)
2) Customize installation
3) Cancel installation
>2
I'm going to ask you the value of each of these installation options.
You may simply press the Enter key to leave unchanged.
Default host triple? [x86_64-pc-windows-msvc]
stable-x86_64-pc-windows-gnu 后续一直回车即可
```
---
### 3. 安装完成,提示如下安装成功
```
Rust is installed now. Great!

To get started you may need to restart your current shell.
This would reload its PATH environment variable to include
Cargo's bin directory (D:\toolchains\Rust\.cargo\bin).

Press the Enter key to continue.
```
### 4. 验证安装是否成功
```
rustc --version
cargo --version
```
## 安装日志:
```text
Rust Visual C++ prerequisites
Rust requires a linker and Windows API libraries but they don't seem to be
available.
These components can be acquired through a Visual Studio installer.
1) Quick install via the Visual Studio Community installer
(free for individuals, academic uses, and open source).
2) Manually install the prerequisites
(for enterprise and advanced users).
3) Don't install the prerequisites
(if you're targeting the GNU ABI).
>2
You can acquire the build tools by installing Microsoft Visual Studio.
https://visualstudio.microsoft.com/downloads/
Check the box for "Desktop development with C++" which will ensure that the
needed components are installed. If your locale language is not English,
then additionally check the box for English under Language packs.
For more details see:
https://rust-lang.github.io/rustup/installation/windows-msvc.html
Install the C++ build tools before proceeding.
If you will be targeting the GNU ABI or otherwise know what you are
doing then it is fine to continue installation without the build
tools, but otherwise, install the C++ build tools before proceeding.
Continue? (y/N)
y
Welcome to Rust!
This will download and install the official compiler for the Rust
programming language, and its package manager, Cargo.
Rustup metadata and toolchains will be installed into the Rustup
home directory, located at:
D:\toolchains\Rust\.rustup
This can be modified with the RUSTUP_HOME environment variable.
The Cargo home directory is located at:
D:\toolchains\Rust\.cargo
This can be modified with the CARGO_HOME environment variable.
The cargo, rustc, rustup and other commands will be added to
Cargo's bin directory, located at:
D:\toolchains\Rust\.cargo\bin
This path will then be added to your PATH environment variable by
modifying the HKEY_CURRENT_USER/Environment/PATH registry key.
You can uninstall at any time with rustup self uninstall and
these changes will be reverted.
Current installation options:
default host triple: x86_64-pc-windows-msvc
default toolchain: stable (default)
profile: default
modify PATH variable: yes
1) Proceed with standard installation (default - just press enter)
2) Customize installation
3) Cancel installation
>2
I'm going to ask you the value of each of these installation options.
You may simply press the Enter key to leave unchanged.
Default host triple? [x86_64-pc-windows-msvc]
stable-x86_64-pc-windows-gnu 后续一直回车即可
..........
You can uninstall at any time with rustup self uninstall and
these changes will be reverted.
Current installation options:
default host triple: x86_64-pc-windows-msvc
default toolchain: stable (default)
profile: default
modify PATH variable: yes
1) Proceed with standard installation (default - just press enter)
2) Customize installation
3) Cancel installation
>
info: profile set to 'default'
info: default host triple is x86_64-pc-windows-gnu
info: syncing channel updates for 'stable-x86_64-pc-windows-gnu'
759.8 KiB / 759.8 KiB (100 %) 287.7 KiB/s in 2s ETA: 0s
info: latest update on 2024-08-08, rust version 1.80.1 (3f5fd8dd4 2024-08-06)
info: downloading component 'cargo'
info: downloading component 'clippy'
info: downloading component 'rust-docs'
info: downloading component 'rust-mingw'
info: downloading component 'rust-std'
info: downloading component 'rustc'
74.7 MiB / 74.7 MiB (100 %) 272.0 KiB/s in 4m 55s ETA: 0s
info: downloading component 'rustfmt'
3.2 MiB / 3.2 MiB (100 %) 269.5 KiB/s in 12s ETA: 0s
info: installing component 'cargo'
info: installing component 'clippy'
info: installing component 'rust-docs'
15.7 MiB / 15.7 MiB (100 %) 1.5 MiB/s in 11s ETA: 0s
info: installing component 'rust-mingw'
info: installing component 'rust-std'
22.5 MiB / 22.5 MiB (100 %) 11.4 MiB/s in 1s ETA: 0s
info: installing component 'rustc'
74.7 MiB / 74.7 MiB (100 %) 13.5 MiB/s in 5s ETA: 0s
info: installing component 'rustfmt'
info: default toolchain set to 'stable-x86_64-pc-windows-gnu'
stable-x86_64-pc-windows-gnu installed - rustc 1.80.1 (3f5fd8dd4 2024-08-06)
Rust is installed now. Great!
To get started you may need to restart your current shell.
This would reload its PATH environment variable to include
Cargo's bin directory (D:\toolchains\Rust\.cargo\bin).
Press the Enter key to continue.
```

1 change: 1 addition & 0 deletions content/posts/Rust/tempCodeRunnerFile.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

4 changes: 2 additions & 2 deletions public/404.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<noscript><link rel="stylesheet" href="/CTGU-Hugo-Blog.io/lib/fontawesome-free/all.min.css"></noscript><link rel="preload" href="/CTGU-Hugo-Blog.io/lib/animate/animate.min.css" as="style" onload="this.removeAttribute('onload');this.rel='stylesheet'">
<noscript><link rel="stylesheet" href="/CTGU-Hugo-Blog.io/lib/animate/animate.min.css"></noscript></head>
<body data-header-desktop="sticky" data-header-mobile="auto"><script>(window.localStorage?.getItem('theme') ? localStorage.getItem('theme') === 'dark' : ('auto' === 'auto' ? window.matchMedia('(prefers-color-scheme: dark)').matches : 'auto' === 'dark')) && document.body.setAttribute('data-theme', 'dark');</script><div class="wrapper" data-page-style="normal"><header class="desktop animate__faster" id="header-desktop">
<div class="header-wrapper">
<div class="header-wrapper" data-github-corner="left">
<div class="header-title">
<a href="/CTGU-Hugo-Blog.io/" title=""><img loading="lazy" src="/CTGU-Hugo-Blog.io/my/hugo.svg" alt="/CTGU-Hugo-Blog.io/my/hugo.svg" data-title="/CTGU-Hugo-Blog.io/my/hugo.svg" width="26" height="26" class="logo" style="background: url(/CTGU-Hugo-Blog.io/images/loading.min.svg) no-repeat center;" onload="this.title=this.dataset.title;for(const i of ['style', 'data-title','onerror','onload']){this.removeAttribute(i);}this.dataset.lazyloaded='';" onerror="this.title=this.dataset.title;for(const i of ['style', 'data-title','onerror','onload']){this.removeAttribute(i);}"/><span class="header-title-text">A common CTGUer&#39;s blog</span></a><span class="header-subtitle"></span></div>
<nav>
Expand Down Expand Up @@ -156,7 +156,7 @@ <h1 id="error-emoji"></h1>
<span id="busuanzi_container_site_uv" title='总访客数'><i class="fa-regular fa-user fa-fw" aria-hidden="true"></i>&nbsp;<span id="busuanzi_value_site_uv"><i class="fa-solid fa-spinner fa-spin fa-fw" aria-hidden="true"></i></span></span><span id="busuanzi_container_site_pv" class="footer-divider" title='总访问量'><i class="fa-regular fa-eye fa-fw" aria-hidden="true"></i>&nbsp;<span id="busuanzi_value_site_pv"><i class="fa-solid fa-spinner fa-spin fa-fw" aria-hidden="true"></i></span></span>
</div></div>
</footer></div><div class="widgets"><div class="fixed-buttons animate__faster d-none"><div class="fixed-button back-to-top" role="button" aria-label="回到顶部"><i class="fa-solid fa-arrow-up fa-fw" aria-hidden="true"></i><span class="variant-numeric">0%</span>
</div><div class="fixed-button view-comments d-none" role="button" aria-label="查看评论"><i class="fa-solid fa-comment fa-fw" aria-hidden="true"></i></div></div><div id="mask"></div><div class="reading-progress-bar" style="left: 0;bottom: 0;width: calc(100% - var(--progress));"></div><noscript>
</div><div class="fixed-button view-comments d-none" role="button" aria-label="查看评论"><i class="fa-solid fa-comment fa-fw" aria-hidden="true"></i></div></div><a href="https://github.com/crack-dawn/CTGU-Hugo-Blog.io" title="在 GitHub 上查看源代码"target="_blank" rel="external nofollow" class="github-corner left d-none-mobile"><svg viewBox="0 0 250 250" aria-hidden="true" width="56" height="56"><path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"></path><path d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2" fill="currentColor" style="transform-origin: 130px 106px;" class="octo-arm"></path><path d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z" fill="currentColor" class="octo-body"></path></svg></a><div id="mask"></div><div class="reading-progress-bar" style="left: 0;bottom: 0;width: calc(100% - var(--progress));"></div><noscript>
<div class="noscript-warning">该网站在启用 JavaScript 的情况下效果最佳。</div>
</noscript>
</div><link rel="preload" href="/CTGU-Hugo-Blog.io/lib/katex/katex.min.css" as="style" onload="this.removeAttribute('onload');this.rel='stylesheet'">
Expand Down
4 changes: 2 additions & 2 deletions public/about/about/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
}
</script></head>
<body data-header-desktop="sticky" data-header-mobile="auto"><script>(window.localStorage?.getItem('theme') ? localStorage.getItem('theme') === 'dark' : ('auto' === 'auto' ? window.matchMedia('(prefers-color-scheme: dark)').matches : 'auto' === 'dark')) && document.body.setAttribute('data-theme', 'dark');</script><div class="wrapper" data-page-style="normal"><header class="desktop animate__faster" id="header-desktop">
<div class="header-wrapper">
<div class="header-wrapper" data-github-corner="left">
<div class="header-title">
<a href="/CTGU-Hugo-Blog.io/" title=""><img loading="lazy" src="/CTGU-Hugo-Blog.io/my/hugo.svg" alt="/CTGU-Hugo-Blog.io/my/hugo.svg" data-title="/CTGU-Hugo-Blog.io/my/hugo.svg" width="26" height="26" class="logo" style="background: url(/CTGU-Hugo-Blog.io/images/loading.min.svg) no-repeat center;" onload="this.title=this.dataset.title;for(const i of ['style', 'data-title','onerror','onload']){this.removeAttribute(i);}this.dataset.lazyloaded='';" onerror="this.title=this.dataset.title;for(const i of ['style', 'data-title','onerror','onload']){this.removeAttribute(i);}"/><span class="header-title-text">A common CTGUer&#39;s blog</span></a><span class="header-subtitle"></span></div>
<nav>
Expand Down Expand Up @@ -262,7 +262,7 @@ <h4 id="注意" class="heading-element"><span>注意</span>
<span id="busuanzi_container_site_uv" title='总访客数'><i class="fa-regular fa-user fa-fw" aria-hidden="true"></i>&nbsp;<span id="busuanzi_value_site_uv"><i class="fa-solid fa-spinner fa-spin fa-fw" aria-hidden="true"></i></span></span><span id="busuanzi_container_site_pv" class="footer-divider" title='总访问量'><i class="fa-regular fa-eye fa-fw" aria-hidden="true"></i>&nbsp;<span id="busuanzi_value_site_pv"><i class="fa-solid fa-spinner fa-spin fa-fw" aria-hidden="true"></i></span></span>
</div></div>
</footer></div><div class="widgets"><div class="fixed-buttons animate__faster d-none"><div class="fixed-button back-to-top" role="button" aria-label="回到顶部"><i class="fa-solid fa-arrow-up fa-fw" aria-hidden="true"></i><span class="variant-numeric">0%</span>
</div></div><div id="mask"></div><div class="reading-progress-bar" style="left: 0;bottom: 0;width: calc(100% - var(--progress));"></div><noscript>
</div></div><a href="https://github.com/crack-dawn/CTGU-Hugo-Blog.io" title="在 GitHub 上查看源代码"target="_blank" rel="external nofollow" class="github-corner left d-none-mobile"><svg viewBox="0 0 250 250" aria-hidden="true" width="56" height="56"><path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"></path><path d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2" fill="currentColor" style="transform-origin: 130px 106px;" class="octo-arm"></path><path d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z" fill="currentColor" class="octo-body"></path></svg></a><div id="mask"></div><div class="reading-progress-bar" style="left: 0;bottom: 0;width: calc(100% - var(--progress));"></div><noscript>
<div class="noscript-warning">该网站在启用 JavaScript 的情况下效果最佳。</div>
</noscript>
</div><link rel="stylesheet" href="/CTGU-Hugo-Blog.io/lib/lightgallery/css/lightgallery-bundle.min.css"><link rel="preload" href="/CTGU-Hugo-Blog.io/lib/katex/katex.min.css" as="style" onload="this.removeAttribute('onload');this.rel='stylesheet'">
Expand Down
Loading

0 comments on commit d7adff0

Please sign in to comment.