From d587af5b14bc980aa62957f4893698dc54c57edc Mon Sep 17 00:00:00 2001 From: garhve Date: Wed, 18 Jan 2023 08:57:33 +0800 Subject: delete blog --- public/categories/code/index.html | 9 ---- public/categories/index.html | 2 +- public/index.html | 28 ---------- public/post/index.html | 28 ---------- public/post/rust-basic/index.html | 107 -------------------------------------- public/sitemap.xml | 7 --- public/tags/index.html | 5 -- public/tags/rust/index.html | 57 -------------------- 8 files changed, 1 insertion(+), 242 deletions(-) delete mode 100644 public/post/rust-basic/index.html delete mode 100644 public/tags/rust/index.html (limited to 'public') 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 @@ -35,15 +35,6 @@

[Category: code]

-

-

- 2023-01-12 -
-
- rust basic -- types and ownership -
-

-

2022-09-29 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 @@
  • /code - (4) + (3)
  • 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 @@ -

    2023

    - - -

    -

    - 2023-01-12 -
    - - - -
    - - -  /code - - - - - -  #rust - - -
    -

    - -

    2022

    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 @@ -

    2023

    - - -

    -

    - 2023-01-12 -
    - - - -
    - - -  /code - - - - - -  #rust - - -
    -

    - -

    2022

    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 @@ - - - - - - -rust basic -- types and ownership | garhve's gibberish - - - - - - - - - - - - - - -
    -
    - -

    -

    rust basic -- types and ownership
    -

    -

    -

    2023-01-12
    -
    - - - /code - - - - -  #rust - - -
    -

    - -

    -

    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 typesrustc
    integeri(u)8/i16/i32(default)/i64(unsigned) char/short/int/long
    floatf32/f64(default)float/double
    booleantrue/falseTrue/False (non-zero/zero)
    charactercharchar
    -

    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 typerustc
    structsamesame
    enumenum element can be seen as key that could take valuerepresent numberic value, default starting from 0
    arrayvectorarray
    stringa wraper of vectorpointer of char *
    tupleexistno 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:

    -
    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/sitemap.xml b/public/sitemap.xml index 89cf628..02cae4b 100644 --- a/public/sitemap.xml +++ b/public/sitemap.xml @@ -58,10 +58,6 @@ https://blog.garhve.com/post/past-is-great/ 2022-11-07 - - https://blog.garhve.com/post/rust-basic/ - 2023-01-12 - https://blog.garhve.com/post/sui-bi-1/ 2022-12-20 @@ -81,7 +77,4 @@ https://blog.garhve.com/tags/linux/ - - https://blog.garhve.com/tags/rust/ - 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)
  • -
  • - #rust - (1) -
  • -
    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 @@ - - - - - - -rust | garhve's gibberish - - - - - - - - - - - -
    - - -
    - - -
    -
    - -

    [Tag: rust]

    - - -

    -

    - 2023-01-12 -
    - -

    - - - -
    -
    - - - - - -- cgit v1.2.3-70-g09d2