minearm-website 0.1.3 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.hintrc +16 -0
- package/README.md +2 -2
- package/package.json +28 -27
- package/public/scripts/mdata.json +3 -3
- package/public/scripts/searchData.json +46 -46
- package/src/components/Search.astro +30 -0
- package/src/components/icons/bilibili.astro +1 -2
- package/src/components/icons/c.astro +1 -2
- package/src/components/icons/cube.astro +1 -2
- package/src/components/icons/hardDriver.astro +1 -2
- package/src/components/icons/home.astro +1 -2
- package/src/components/loading/loading.vue +0 -12
- package/src/components/postlist/pagination.astro +39 -25
- package/src/components/postlist/postsList.astro +57 -0
- package/src/content/blog/history//345/205/254/345/205/203/345/211/215//347/247/246/345/247/213/347/232/207/347/273/237/344/270/200/345/205/255/345/233/275.md +1 -0
- package/src/content/blog/history//350/277/221/344/273/243/347/257/207//344/270/255/345/233/275/345/205/261/344/272/247/345/205/232/345/205/232/345/217/262.md +2360 -2361
- package/src/content/blog/it/Rust/345/237/272/346/234/254/350/257/255/346/263/225.md +14 -0
- package/src/content/config.ts +0 -1
- package/src/layouts/BaseLayout.astro +1 -0
- package/src/layouts/DefaultMdLayout.astro +4 -0
- package/src/layouts/HomeLayout.astro +2 -0
- package/src/layouts/TagsLayout.astro +1 -0
- package/src/pages/[...page].astro +13 -10
- package/src/pages/about/index.md +2 -2
- package/src/pages/friends/index.md +3 -3
- package/src/styles/components/aside.scss +1 -1
- package/src/styles/components/header.scss +1 -1
- package/src/styles/components/main.scss +1 -1
- package/src/styles/global.scss +2 -2
- package/src/styles/tags/tags.scss +13 -23
- package/src/theme_config.ts +1 -1
@@ -23,6 +23,7 @@ category: 'Rust'
|
|
23
23
|
这些基础概念将存在于每个 Rust 程序中,及早学习它们将使你以最快的速度学习 Rust 的使用。
|
24
24
|
|
25
25
|
# 变量
|
26
|
+
|
26
27
|
首先必须说明,Rust 是强类型语言,但具有自动判断变量类型的能力。这很容易让人与弱类型语言产生混淆。
|
27
28
|
|
28
29
|
默认情况下,Rust 中的变量是不可变的,除非使用 mut 关键字声明为可变变量。
|
@@ -110,6 +111,7 @@ fn add(a: i32, b: i32) -> i32 {
|
|
110
111
|
如果函数没有返回值,类型默认为 ()(即空元组)。
|
111
112
|
|
112
113
|
**控制流**
|
114
|
+
|
113
115
|
# if 表达式
|
114
116
|
|
115
117
|
- 实例
|
@@ -121,6 +123,7 @@ if number < 5 {
|
|
121
123
|
println!("大于等于 5");
|
122
124
|
}
|
123
125
|
```
|
126
|
+
|
124
127
|
# loop 循环
|
125
128
|
|
126
129
|
loop 是 Rust 中的无限循环,可以使用 break 退出循环。
|
@@ -155,7 +158,9 @@ for number in 1..4 {
|
|
155
158
|
println!("{}!", number);
|
156
159
|
}
|
157
160
|
```
|
161
|
+
|
158
162
|
# 所有权
|
163
|
+
|
159
164
|
Rust 中的所有权是独特的内存管理机制,核心概念包括所有权 (ownership)、借用 (borrowing) 和引用 (reference)。
|
160
165
|
|
161
166
|
所有权规则:
|
@@ -168,8 +173,11 @@ let s1 = String::from("hello");
|
|
168
173
|
let s2 = s1; // s1 的所有权被转移给了 s2
|
169
174
|
// println!("{}", s1); // 此处编译会报错,因为 s1 已不再拥有该值
|
170
175
|
```
|
176
|
+
|
171
177
|
# 借用和引用
|
178
|
+
|
172
179
|
借用允许引用数据而不获取所有权,通过 & 符号实现。
|
180
|
+
|
173
181
|
```rust
|
174
182
|
fn main() {
|
175
183
|
let s = String::from("hello");
|
@@ -181,6 +189,7 @@ fn calculate_length(s: &String) -> usize {
|
|
181
189
|
s.len()
|
182
190
|
}
|
183
191
|
```
|
192
|
+
|
184
193
|
# 结构体
|
185
194
|
|
186
195
|
结构体用于创建自定义类型,字段可以包含多种数据类型。
|
@@ -201,6 +210,7 @@ let user1 = User {
|
|
201
210
|
active: true,
|
202
211
|
};
|
203
212
|
```
|
213
|
+
|
204
214
|
# 枚举
|
205
215
|
|
206
216
|
枚举允许定义可能的几种数据类型中的一种。
|
@@ -215,7 +225,9 @@ enum IpAddrKind {
|
|
215
225
|
let four = IpAddrKind::V4;
|
216
226
|
let six = IpAddrKind::V6;
|
217
227
|
```
|
228
|
+
|
218
229
|
# 模式匹配
|
230
|
+
|
219
231
|
match 是 Rust 中强大的控制流工具,类似于 switch 语句。
|
220
232
|
|
221
233
|
- 实例
|
@@ -236,6 +248,7 @@ fn value_in_cents(coin: Coin) -> u8 {
|
|
236
248
|
}
|
237
249
|
}
|
238
250
|
```
|
251
|
+
|
239
252
|
# 错误处理
|
240
253
|
|
241
254
|
Rust 有两种主要的错误处理方式:Result<T, E> 和 Option<T>。
|
@@ -282,6 +295,7 @@ fn longest<'a>(x: &'a str, y: &'a str) -> &'a str {
|
|
282
295
|
}
|
283
296
|
}
|
284
297
|
```
|
298
|
+
|
285
299
|
# 重影
|
286
300
|
|
287
301
|
重影的概念与其他面向对象语言里的"重写"(Override)或"重载"(Overload)是不一样的。重影就是刚才讲述的所谓"重新绑定",之所以加引号就是为了在没有介绍这个概念的时候代替一下概念。
|
package/src/content/config.ts
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
import "@style/global.scss";
|
3
3
|
import "@style/components/page-content.scss";
|
4
4
|
import HeadInsert from "@comp/HeadInject.astro";
|
5
|
+
import { ViewTransitions } from 'astro:transitions';
|
5
6
|
import BodyInsert from "@comp/BodyInject.astro";
|
6
7
|
import { ThemeConfig } from "@src/theme_config";
|
7
8
|
import Header from "@comp/header/Header.astro";
|
@@ -1,7 +1,9 @@
|
|
1
1
|
---
|
2
2
|
import HeroWave from "@comp/header/heroWave.astro";
|
3
3
|
import PostLayout from "@src/layouts/PostLayout.astro";
|
4
|
+
import { ViewTransitions } from 'astro:transitions';
|
4
5
|
import { ThemeConfig } from "@src/theme_config";
|
6
|
+
import Code from '../components/icons/code.astro';
|
5
7
|
interface FrontMatter {
|
6
8
|
title: string;
|
7
9
|
description?: string;
|
@@ -34,9 +36,11 @@ const { frontmatter } = Astro.props;
|
|
34
36
|
slot="post-hero"
|
35
37
|
heroColor={frontmatter.heroColor}
|
36
38
|
>
|
39
|
+
|
37
40
|
<div class="post-info">
|
38
41
|
<h1 class="post-title">{frontmatter.title}</h1>
|
39
42
|
</div>
|
40
43
|
</HeroWave>
|
41
44
|
<slot />
|
42
45
|
</PostLayout>
|
46
|
+
<ViewTransitions />
|
@@ -1,6 +1,7 @@
|
|
1
1
|
---
|
2
2
|
import "@style/components/main.scss";
|
3
3
|
import BaseLayout from "./BaseLayout.astro";
|
4
|
+
import { ViewTransitions } from 'astro:transitions';
|
4
5
|
import Aside from "@comp/aside/aside.astro";
|
5
6
|
import { ThemeConfig } from "@src/theme_config";
|
6
7
|
interface Props {
|
@@ -23,3 +24,4 @@ const { asideDir } = Astro.props;
|
|
23
24
|
</main>
|
24
25
|
</article>
|
25
26
|
</BaseLayout>
|
27
|
+
<ViewTransitions />
|
@@ -1,5 +1,6 @@
|
|
1
1
|
---
|
2
2
|
import PostsList from "@comp/postlist/postsList.astro";
|
3
|
+
import { ViewTransitions } from 'astro:transitions';
|
3
4
|
import Pagination from "@comp/postlist/pagination.astro";
|
4
5
|
import HomeLayout from "@layout/HomeLayout.astro";
|
5
6
|
import HeroWave from "@comp/header/heroWave.astro";
|
@@ -6,11 +6,14 @@ import { ThemeConfig } from "@src/theme_config";
|
|
6
6
|
import { utils } from "@src/utils/utils";
|
7
7
|
import { type CollectionEntry, getCollection } from "astro:content";
|
8
8
|
|
9
|
-
export async function getStaticPaths({ paginate }
|
10
|
-
const posts
|
11
|
-
|
12
|
-
|
13
|
-
|
9
|
+
export async function getStaticPaths({ paginate }) {
|
10
|
+
const posts = await getCollection("blog");
|
11
|
+
|
12
|
+
// 根据 pubDate 排序文章
|
13
|
+
const sortedPosts = posts.sort((a, b) => utils.compareDates(a.data.pubDate, b.data.pubDate));
|
14
|
+
|
15
|
+
// 使用 paginate 生成分页路径,每页 10 篇文章
|
16
|
+
return paginate(sortedPosts, { pageSize: 8 });
|
14
17
|
}
|
15
18
|
|
16
19
|
const { page } = Astro.props;
|
@@ -39,11 +42,11 @@ if (!page || !page.data) {
|
|
39
42
|
<PostsList posts={page.data} />
|
40
43
|
{
|
41
44
|
page.lastPage > 1 && (
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
45
|
+
<Pagination
|
46
|
+
baseurl=""
|
47
|
+
currentPage={page.currentPage}
|
48
|
+
totalPages={page.lastPage}
|
49
|
+
/>
|
47
50
|
)
|
48
51
|
}
|
49
52
|
</Fragment>
|
package/src/pages/about/index.md
CHANGED
@@ -8,10 +8,10 @@ useToc: true
|
|
8
8
|
---
|
9
9
|
# Minearm & Website
|
10
10
|
# 本主题是从[HusBlog](https://github.com/KraHsu/HsuBlog.git)改进而来的
|
11
|
-
最新的正式版是0.
|
11
|
+
最新的正式版是0.2.0
|
12
12
|
最新的测试版是0.0.3-beta.4
|
13
13
|
|
14
|
-
但是Minearm & Website做出了很大的改变,比如修复了scss警告和升级astro版本到5.1.
|
14
|
+
但是Minearm & Website做出了很大的改变,比如修复了scss警告和升级astro版本到5.1.10
|
15
15
|
|
16
16
|
# 效果
|
17
17
|

|
@@ -1,5 +1,5 @@
|
|
1
1
|
---
|
2
|
-
layout:
|
2
|
+
layout: ../../layouts/DefaultMdLayout.astro
|
3
3
|
title: Minearm盟友
|
4
4
|
description: ""
|
5
5
|
heroColor: "#007aff"
|
@@ -17,8 +17,8 @@ useToc: true
|
|
17
17
|
|
18
18
|
::link[B站破击]{logo="/pojipao.avif" desc="全互联网最中二的傻逼" link="https://space.bilibili.com/1598534390"}
|
19
19
|
|
20
|
-
::link[
|
20
|
+
::link[এ՞情绪ᮨ℘]{logo="/13.png" desc="明天要被历史肘击😭" link="mailto:2939765322@qq.com"}
|
21
21
|
|
22
22
|
::link[三的根号]{logo="/3.png" desc="√3每日发疯" link="https://space.bilibili.com/1832902560"}
|
23
23
|
|
24
|
-
::link[
|
24
|
+
::link[智宇]{logo="https://zhiyuhub.top/upload/be2bb1bb-8d91-4e9b-8b4d-00d4c45774ae.png" desc="root@kali:/#" link="https://zhiyuhub.top/"}
|
package/src/styles/global.scss
CHANGED
@@ -1,69 +1,56 @@
|
|
1
|
-
@
|
1
|
+
@use "../mixin.scss" as *;
|
2
|
+
|
2
3
|
.tags-wrap {
|
3
4
|
display: flex;
|
4
|
-
|
5
5
|
align-items: center;
|
6
|
-
|
7
6
|
justify-content: center;
|
8
|
-
|
9
7
|
min-height: 300px;
|
8
|
+
|
10
9
|
.tags {
|
11
10
|
display: flex;
|
12
|
-
|
13
11
|
align-items: center;
|
14
|
-
|
15
12
|
flex-wrap: wrap;
|
16
|
-
|
17
13
|
justify-content: center;
|
18
|
-
|
19
14
|
width: 100%;
|
20
|
-
|
21
15
|
max-width: 800px;
|
16
|
+
|
22
17
|
.tag {
|
23
18
|
margin: 0.5rem;
|
24
|
-
|
25
19
|
padding: 5px 8px;
|
26
|
-
|
27
20
|
text-decoration: none;
|
28
|
-
|
29
21
|
color: var(--font-black-white);
|
30
|
-
|
31
22
|
border-radius: 10px;
|
32
|
-
|
33
23
|
background-color: var(--card-background);
|
34
|
-
|
35
24
|
font-size: 20px;
|
36
|
-
|
25
|
+
|
37
26
|
@include card-style();
|
27
|
+
|
38
28
|
&:hover {
|
39
29
|
transform: scale(1.2);
|
40
|
-
|
41
30
|
color: white;
|
42
|
-
|
43
31
|
background: var(--theme-color);
|
32
|
+
|
44
33
|
.tag-text {
|
45
34
|
&::before {
|
46
35
|
color: white;
|
47
36
|
}
|
48
37
|
}
|
49
38
|
}
|
39
|
+
|
50
40
|
.tag-text {
|
51
41
|
&::before {
|
52
42
|
margin-right: 3px;
|
53
|
-
|
54
43
|
content: "#";
|
55
|
-
|
56
44
|
transition: 0.3s ease;
|
57
|
-
|
58
45
|
color: var(--font-light-grey);
|
59
46
|
}
|
60
47
|
}
|
61
48
|
}
|
62
|
-
|
49
|
+
|
63
50
|
&.floating {
|
64
51
|
.tag {
|
65
52
|
animation: floating 7s ease-in-out infinite alternate;
|
66
|
-
|
53
|
+
|
67
54
|
&:nth-child(3n + 1) {
|
68
55
|
animation-delay: 0s;
|
69
56
|
}
|
@@ -77,7 +64,10 @@
|
|
77
64
|
}
|
78
65
|
}
|
79
66
|
}
|
67
|
+
|
80
68
|
#inner-container {
|
81
69
|
.main-content {
|
70
|
+
// 这里可以添加具体的样式或内容
|
71
|
+
// 例如:padding: 20px;
|
82
72
|
}
|
83
73
|
}
|