說明文件測試
Rust 說明文件的主題涵蓋甚廣,包括:
- All of the details about loops.
- 基本型別,例如
u8
。 - Standard library types like
Option
orBinaryHeap
.
您其實可以將程式碼記錄下來:
系統會將內容視為 Markdown。所有已發布的 Rust 程式庫 Crate,都會使用 rustdoc 工具自動記錄於 docs.rs
中。這種記錄 API 中所有公開項目的模式是慣用做法。
如要從項目內部 (例如在模組內) 記錄項目,請使用 //!
或 /*! .. */
,這也稱做「內部文件註解」:
Speaker Notes
This slide should take about 5 minutes.
- Show students the generated docs for the
rand
crate at https://docs.rs/rand.