WilsonKuo
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee
    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee
  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       owned this note    owned this note      
    Published Linked with GitHub
    5
    Subscribed
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    Subscribe
    --- tags: RUST LANGUAGE --- # [Crust of Rust](/jLixlQ1ASZaBHqCBDFu1Iw): 筆記說明 ## 筆記說明 Crust of Rust 系列是根據 [Jon Gjengset](https://thesquareplanet.com/) 的直播所記錄下的學習筆記,他透過實作來加深您對 Rust 程式的理解,他不會一開始就實作出最終版本,而是漸進式的實作的帶著您實作,這樣做的好處是能幫助您建立程式設計師應有的思維並解決問題,他還會帶您閱讀官方文件來協助您打下更扎實的基礎。本系列適合已經有編寫或閱讀過 Rust 相關書籍的讀者,若有 C 語言開發相關的經驗,將更能夠理解 Rust 編譯器嘗試解決的問題究竟是什麼。 ## Crust of Rust * [Lifetime Annotations](/F8zEmei9Q6KmwOnQ5H1Vug) (2023.12) * 多個的生命週期使用情境 * 避免字串造成的記憶體配置所帶來的效能衝擊 * 為不同的資料型別實作 trait * [Declarative Macros](/0WPhprK_Rv2_W3QBkWx2gQ) (2023.12) * 巨集的基礎使用 * Hygiene 避免巨集內部變數影響到巨集外部變數 * 模式與樣板的重複用法 * 避免因為 Vec 大小一直改變而重新配置記憶體的解決辦法 * 尾隨逗號的處理方法 (包含遞迴呼叫巨集版本) * 陣列元素的計數技巧 (包含遞迴呼叫巨集版本) * [Iterators](/RJ5zG5xuTN2e7bYT6-AJWQ) (2024.01) * Iterator, IntoIterator 介紹 * 實作 flatten 功能 * 透過讓 flatten 支援雙向走訪了解巢狀 bound 的使用 * 先 flatten 再走訪的缺點分析 * [Smart Pointers and Interior Mutability](/HpIQAfztQjOPyb0u1-BB2g) (2024.01) * 介紹 interior mutability * 實作 Cell 型別理解如何限制程式只能單一執行緒執行。 * RefCell 型別的狀態轉換 (使用 Cell 限制程式單一執行緒執行) * Rc 參考計數設值的細節 (使用 Cell 限制程式單一執行緒執行) * NonNull 指標, PhantomData 型別用途以及 Drop Check 機制 * Cow 型態的使用時機 * [Channels](/4fdUqz6NTaSOJ46xStlQtg) (2024.01) * 實作 MPSC - Mutex, Condvar, Arc * 處理 0 Sender/Receiver 的方法 * 批次接收資料最佳化 * Channel flavors - Synchronous, Asynchronous, Rendezvous 以及 Oneshot * Future-aware channels * [Sorting Algorithms](/vWR6QRvOSGKvDba1opOqfg) (2024.01) * 實作 Bubble sort, Insertion sort, Selection sort 以及 Quick sort * 為測試元素實作 PartialEq, PartialOrd, Ord * Benchmark 比較次數以及執行時間 * [Subtyping and Variance](/3GuLI4EiRtWlu8lB0plxlg) (2024.01) * subtyping 的定義 * 透過實作 strtok 函式理解 covariance 以及 invaraince * 透過簡單的函式理解 contravariance * Variance, PhantomData 與 drop check 之間的關係 * [The Drop Check](/Uoas5s4pQZKxD4eza0tR5A) (2024.01) * 實作 Boks 理解 drop check 機制 (dropck_eyepatch, may_dangle) * 如何讓自定義型別為 covaraint in T (NonNull) * [Atomics and Memory Ordering](/2HDiZxKQQU-J3Cq7AMVIhw) (2024.02) * 實作 Mutex 理解 MESI protocol 以及 happens-before * `compare_exchange` vs. `compare_exchange_weak` * Ordering::SeqCst 說明 * volatile 的實際用途 * [Dispatch and Fat Pointers](/jZvp4MkFRkmZnpV0d7ajGA) (2024.02) * 泛型參數的 Monomorphization * Sized 與 not Sized 對程式帶來的影響 * Static Dispatch 以及 Dynamic Dispatch (包含 vtable 的介紹) * Object safe 的必要條件 * 如何使 trait 物件為 Partial Object Safety * trait 物件的限制以及解決方法 * [async/await](/XaQqY2FySgWAQa-U61sxCw) (~~2024.02~~) * 施工中 * [Functions, Closures, and Their Traits](/NbkPk5OJT2K7urueGqzxVQ) (2024.02) * Function item 與函式指標的差異 * capturing/ non-capturing closure 的差異 * static/ non-static closure 的差異 * `Fn`/ `FnMut`/ `FnOnce` trait 的差異 * [Send, Sync, and their implementors](/sM8MtsewRwCkeT4vb2V2lA) (2024.02) * 藉由簡易版的 Rc 來理解 Send * Send 與 Sync 之間的差異 * Negative 實作的用途 * 檢視 Send 和 Sync 的一些 implementors * [Build Scripts and Foreign-Function Interfaces (FFI)](/W_kva_H_RYaW8DTxHLTAQw) (2024.02) * 透過 libsodium/ libssh2-sys/libgit2-sys crate 了解建置腳本功能 * 測試 bindgen 以及 pkg-config 功能 * 實作 libsodium-sys 了解 Rust 如何使用 C 外部函式 * [std::collections](/ht8msrixQGiQM-cifPQ-xg) (2024.02) * Sequences: Vec, VecDeque, LinkedList * Sets: HashSet, BTreeSet * Maps: HashMap, BTreeMap * Misc: BinaryHeap * 探討 Option, Result, `()` 是否為 colleciton 類型 ## 筆記編排 * 斜體字 (*Italic*) 代表新術語、URLs、email 地址、檔名,與副檔名。 * 定寬字 (`Constant width`) 代表程式,也在文章中代表程式元素,例如變數或函式名稱、資料庫、資料型別、環境變數、陳述式,與關鍵字。 * 定寬粗體字 (**Constant width bold**) 代表應由使用者親自輸入的命令或其他文字。 * 定寬斜體 (*`Constant width italic`*) 這種文字應換成使用者提供的值,或由程式程式脈絡決定的值。 ::: info :bulb: 該圖示代表提示或建議。 ::: ::: success :pencil2: 該圖示代表一般註釋。 ::: ::: warning :warning: 該圖示代表警告或注意。 :::

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully