- Learning Rust
- Paul Johnson Vesa Kaihlavirta
- 93字
- 2021-07-02 23:07:14
Creating documentation using Cargo
As with other languages, Rust is able to create documentation based on meta tags with the source files. Take the following example:
fn main() { print_multiply(4, 5); } /// A simple function example /// /// # Examples /// /// ``` /// print_multiply(3, 5); /// /// ``` fn print_multiply(x: i32, y: i32) { println!("x * y = {}", x * y); }
The comments preceded by /// will be converted into documentation.
The documentation can be created in one of two ways: via Cargo or by using the rustdoc program.
推薦閱讀
- HoloLens Beginner's Guide
- 青少年軟件編程基礎與實戰(圖形化編程三級)
- Java Web開發之道
- Cassandra Design Patterns(Second Edition)
- aelf區塊鏈應用架構指南
- 區塊鏈:以太坊DApp開發實戰
- Hands-On JavaScript High Performance
- Learning Python by Building Games
- Node.js全程實例
- Getting Started with Hazelcast(Second Edition)
- 西門子S7-200 SMART PLC編程從入門到實踐
- RESTful Java Web Services(Second Edition)
- Raspberry Pi Robotic Projects(Third Edition)
- FFmpeg開發實戰:從零基礎到短視頻上線
- 遠方:兩位持續創業者的點滴思考