summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgarhve <git@garhve.com>2023-01-18 08:57:33 +0800
committergarhve <git@garhve.com>2023-01-18 08:57:33 +0800
commitd587af5b14bc980aa62957f4893698dc54c57edc (patch)
treeccedced7e188c4ccbee91bb314fe23710806894d
parentf32a1f25a36c6611fd34525cb321dd9a50cab5aa (diff)
delete blog
-rw-r--r--content/post/rust basic.md53
-rw-r--r--public/categories/code/index.html9
-rw-r--r--public/categories/index.html2
-rw-r--r--public/index.html28
-rw-r--r--public/post/index.html28
-rw-r--r--public/post/rust-basic/index.html107
-rw-r--r--public/sitemap.xml7
-rw-r--r--public/tags/index.html5
-rw-r--r--public/tags/rust/index.html57
9 files changed, 1 insertions, 295 deletions
diff --git a/content/post/rust basic.md b/content/post/rust basic.md
deleted file mode 100644
index 8ab3401..0000000
--- a/content/post/rust basic.md
+++ /dev/null
@@ -1,53 +0,0 @@
-+++
-title = "rust basic -- types and ownership"
-date = 2023-01-12
-[taxonomies]
-categories = ["code"]
-tags = ["rust"]
-[extra]
-math = false
-+++
-
-## Types
-> This is a summary of rust basic knowledge I learned from (Rust the Book)[https://doc.rust-lang.org/book/] chapter 1 ~ chapter 13
-> I will use C to compare with since I familiar it.
-
-There are a bunch of built-in types we can work with: *scalar types* and *compound types*.
-Those scalar types are just alike as C language.
-
-| scalar types | rust | c |
-| ------------- |------------- | ------- |
-| integer | i(u)8/i16/i32(default)/i64 | (unsigned) char/short/int/long |
-| float | f32/f64(default) | float/double |
-| boolean | true/false | True/False (non-zero/zero) |
-| character | char | char |
-
-The compound types are a bit different. rust provides many hands-on types where C type is not the same or needs to define explicitly.
-
-| compound type | rust | c |
-| ------------- |------------- | ------- |
-| struct | same | same |
-| enum | enum element can be seen as key that could take value | represent numberic value, default starting from 0 |
-| array | vector | array |
-| string | a wraper of vector | pointer of char * |
-| tuple | exist | no such type in C |
-
-Variable declaration in rust is kinda tricky.
-
-A normal declare syntax would be like `let unmutable_variable = 3`. This will imply that variable is `i32` type
-since the value we assign to is a integer and the default type for integer on most OS is `i32`.
-We can explicit type by using type annotation: `let unmutable_variable: u8 = 3`. This will make variable
-`unmutable_variable` is `u8` type and has 3 as its value. We need to assign a value
-to variable if we don't annotate type while declaration, otherwise compiler would prompt error.
-
-Notice that, declaration as above one won't allow us to change value, if we want to be able to change variable's
-value at runtime, we need to explicit it, for security reason:
-```rust
-let mut mutable_variable = 3;
-println!("first define: {mutable_variable}");
-mutable_variable = 5;
-
-println!("change value to: {mutable_variable}");
-```
-
-> `println!()` is called macro, which would not cover for now.
diff --git a/public/categories/code/index.html b/public/categories/code/index.html
index 5573296..ef76831 100644
--- a/public/categories/code/index.html
+++ b/public/categories/code/index.html
@@ -37,15 +37,6 @@
<p>
<div class="date">
- 2023-01-12
- </div>
- <div class="archive_title">
- <a href="https://blog.garhve.com/post/rust-basic/">rust basic -- types and ownership</a>
- </div>
-</p>
-
-<p>
- <div class="date">
2022-09-29
</div>
<div class="archive_title">
diff --git a/public/categories/index.html b/public/categories/index.html
index bb154ac..addaa1a 100644
--- a/public/categories/index.html
+++ b/public/categories/index.html
@@ -38,7 +38,7 @@
<li>
<a href="https:&#x2F;&#x2F;blog.garhve.com&#x2F;categories&#x2F;code&#x2F;">/code</a>
- (4)
+ (3)
</li>
<li>
diff --git a/public/index.html b/public/index.html
index 51cc3e5..44f11a4 100644
--- a/public/index.html
+++ b/public/index.html
@@ -35,34 +35,6 @@
- <h3>2023 </h3>
-
-
- <p>
- <div class="date">
- 2023-01-12
- </div>
-
- <div class="title">
- <a href="https://blog.garhve.com/post/rust-basic/">rust basic -- types and ownership</a>
- </div>
-
- <div class="taxonomies_index">
-
-
- &emsp;<a href="https://blog.garhve.com/categories/code/">/code</a>
-
-
-
-
-
- &emsp;<a href="https://blog.garhve.com/tags/rust/">#rust</a>
-
-
- </div>
- </p>
-
-
<h3>2022 </h3>
diff --git a/public/post/index.html b/public/post/index.html
index 51cc3e5..44f11a4 100644
--- a/public/post/index.html
+++ b/public/post/index.html
@@ -35,34 +35,6 @@
- <h3>2023 </h3>
-
-
- <p>
- <div class="date">
- 2023-01-12
- </div>
-
- <div class="title">
- <a href="https://blog.garhve.com/post/rust-basic/">rust basic -- types and ownership</a>
- </div>
-
- <div class="taxonomies_index">
-
-
- &emsp;<a href="https://blog.garhve.com/categories/code/">/code</a>
-
-
-
-
-
- &emsp;<a href="https://blog.garhve.com/tags/rust/">#rust</a>
-
-
- </div>
- </p>
-
-
<h3>2022 </h3>
diff --git a/public/post/rust-basic/index.html b/public/post/rust-basic/index.html
deleted file mode 100644
index e7d9d0a..0000000
--- a/public/post/rust-basic/index.html
+++ /dev/null
@@ -1,107 +0,0 @@
-<!DOCTYPE html>
-<html lang="en">
-
-<head>
- <meta charset="utf-8">
-
-<title>rust basic -- types and ownership | garhve&#x27;s gibberish</title>
-
-
- <link rel="shortcut icon" type="image/png" href="&#x2F;images&#x2F;favicon.png">
- <meta name="viewport" content="width=device-width,initial-scale=1">
-
- <link id="stylesheet" rel="stylesheet" type="text/css" href="/dark.css">
-
- <script type="text/javascript" src="/js/theme.js"></script>
-
-</head>
-
-<div class="header">
- <div class="site_title">
- <p><a href="/"><img src="https:&#x2F;&#x2F;blog.garhve.com&#x2F;images&#x2F;logo.png" alt="garhve&#x27;s gibberish"
- width="70" height=auto></a></p>
- <p><a href="/">&nbsp;garhve&#x27;s gibberish</a></p>
- </div>
- <div class="menu">
- <!-- <a href="/tags">tags</a>
- &nbsp;--><a href="/categories">categories</a>
- </div>
-</div>
-
-<body onload="getTheme()">
- <section class="section">
- <div class="container">
-
-<p>
- <div class="title_postpage">rust basic -- types and ownership</div>
-</p>
-<p>
- <div class="date_postpage">2023-01-12</div>
- <div class="taxonomies_postpage">
-
-
- <a href="https://blog.garhve.com/categories/code/">/code</a>
-
-
-
-
- &emsp;<a href="https://blog.garhve.com/tags/rust/">#rust</a>
-
-
- </div>
-</p>
-
-<p>
- <h2 id="types">Types</h2>
-<blockquote>
-<p>This is a summary of rust basic knowledge I learned from (Rust the Book)[https://doc.rust-lang.org/book/] chapter 1 ~ chapter 13
-I will use C to compare with since I familiar it.</p>
-</blockquote>
-<p>There are a bunch of built-in types we can work with: <em>scalar types</em> and <em>compound types</em>.
-Those scalar types are just alike as C language.</p>
-<table><thead><tr><th>scalar types</th><th>rust</th><th>c</th></tr></thead><tbody>
-<tr><td>integer</td><td>i(u)8/i16/i32(default)/i64</td><td>(unsigned) char/short/int/long</td></tr>
-<tr><td>float</td><td>f32/f64(default)</td><td>float/double</td></tr>
-<tr><td>boolean</td><td>true/false</td><td>True/False (non-zero/zero)</td></tr>
-<tr><td>character</td><td>char</td><td>char</td></tr>
-</tbody></table>
-<p>The compound types are a bit different. rust provides many hands-on types where C type is not the same or needs to define explicitly.</p>
-<table><thead><tr><th>compound type</th><th>rust</th><th>c</th></tr></thead><tbody>
-<tr><td>struct</td><td>same</td><td>same</td></tr>
-<tr><td>enum</td><td>enum element can be seen as key that could take value</td><td>represent numberic value, default starting from 0</td></tr>
-<tr><td>array</td><td>vector</td><td>array</td></tr>
-<tr><td>string</td><td>a wraper of vector</td><td>pointer of char *</td></tr>
-<tr><td>tuple</td><td>exist</td><td>no such type in C</td></tr>
-</tbody></table>
-<p>Variable declaration in rust is kinda tricky.</p>
-<p>A normal declare syntax would be like <code>let unmutable_variable = 3</code>. This will imply that variable is <code>i32</code> type
-since the value we assign to is a integer and the default type for integer on most OS is <code>i32</code>.
-We can explicit type by using type annotation: <code>let unmutable_variable: u8 = 3</code>. This will make variable
-<code>unmutable_variable</code> is <code>u8</code> type and has 3 as its value. We need to assign a value
-to variable if we don't annotate type while declaration, otherwise compiler would prompt error.</p>
-<p>Notice that, declaration as above one won't allow us to change value, if we want to be able to change variable's
-value at runtime, we need to explicit it, for security reason: </p>
-<pre data-lang="rust" style="background-color:#2e3440;color:#d8dee9;" class="language-rust "><code class="language-rust" data-lang="rust"><span style="color:#81a1c1;">let mut</span><span> mutable_variable </span><span style="color:#81a1c1;">= </span><span style="color:#b48ead;">3</span><span style="color:#eceff4;">;
-</span><span>println!(</span><span style="color:#a3be8c;">&quot;first define: </span><span style="color:#ebcb8b;">{mutable_variable}</span><span style="color:#a3be8c;">&quot;</span><span>)</span><span style="color:#eceff4;">;
-</span><span>mutable_variable </span><span style="color:#81a1c1;">= </span><span style="color:#b48ead;">5</span><span style="color:#eceff4;">;
-</span><span>
-</span><span>println!(</span><span style="color:#a3be8c;">&quot;change value to: </span><span style="color:#ebcb8b;">{mutable_variable}</span><span style="color:#a3be8c;">&quot;</span><span>)</span><span style="color:#eceff4;">;
-</span></code></pre>
-<blockquote>
-<p><code>println!()</code> is called macro, which would not cover for now.</p>
-</blockquote>
-
-</p>
-
-
-
-
- </div>
- </section>
-</body>
-
-<div class="footer">
- &emsp;&copy; garhve
-</div>
-
-</html>
diff --git a/public/sitemap.xml b/public/sitemap.xml
index 89cf628..02cae4b 100644
--- a/public/sitemap.xml
+++ b/public/sitemap.xml
@@ -59,10 +59,6 @@
<lastmod>2022-11-07</lastmod>
</url>
<url>
- <loc>https://blog.garhve.com/post/rust-basic/</loc>
- <lastmod>2023-01-12</lastmod>
- </url>
- <url>
<loc>https://blog.garhve.com/post/sui-bi-1/</loc>
<lastmod>2022-12-20</lastmod>
</url>
@@ -81,7 +77,4 @@
<url>
<loc>https://blog.garhve.com/tags/linux/</loc>
</url>
- <url>
- <loc>https://blog.garhve.com/tags/rust/</loc>
- </url>
</urlset>
diff --git a/public/tags/index.html b/public/tags/index.html
index 3aa2945..64ba538 100644
--- a/public/tags/index.html
+++ b/public/tags/index.html
@@ -56,11 +56,6 @@
(1)
</li>
- <li>
- <a href="https:&#x2F;&#x2F;blog.garhve.com&#x2F;tags&#x2F;rust&#x2F;">#rust</a>
- (1)
- </li>
-
</ul>
</div>
diff --git a/public/tags/rust/index.html b/public/tags/rust/index.html
deleted file mode 100644
index 5928831..0000000
--- a/public/tags/rust/index.html
+++ /dev/null
@@ -1,57 +0,0 @@
-<!DOCTYPE html>
-<html lang="en">
-
-<head>
- <meta charset="utf-8">
-
-<title>rust | garhve&#x27;s gibberish</title>
-
-
- <link rel="shortcut icon" type="image/png" href="&#x2F;images&#x2F;favicon.png">
- <meta name="viewport" content="width=device-width,initial-scale=1">
-
- <link id="stylesheet" rel="stylesheet" type="text/css" href="/dark.css">
-
- <script type="text/javascript" src="/js/theme.js"></script>
-
-</head>
-
-<div class="header">
- <div class="site_title">
- <p><a href="/"><img src="https:&#x2F;&#x2F;blog.garhve.com&#x2F;images&#x2F;logo.png" alt="garhve&#x27;s gibberish"
- width="70" height=auto></a></p>
- <p><a href="/">&nbsp;garhve&#x27;s gibberish</a></p>
- </div>
- <div class="menu">
- <!-- <a href="/tags">tags</a>
- &nbsp;--><a href="/categories">categories</a>
- </div>
-</div>
-
-<body onload="getTheme()">
- <section class="section">
- <div class="container">
-
-<p class="archive_title">[Tag: rust]</p>
-
-
-<p>
- <div class="date">
- 2023-01-12
- </div>
- <div class="archive_title">
- <a href="https://blog.garhve.com/post/rust-basic/">rust basic -- types and ownership</a>
- </div>
-</p>
-
-
-
- </div>
- </section>
-</body>
-
-<div class="footer">
- &emsp;&copy; garhve
-</div>
-
-</html>