官术网_书友最值得收藏!

  • 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.

主站蜘蛛池模板: 阜新| 太和县| 旺苍县| 饶平县| 辛集市| 甘洛县| 格尔木市| 平原县| 马尔康县| 凤山市| 金溪县| 读书| 木兰县| 甘孜县| 孝昌县| 重庆市| 亚东县| 景洪市| 资中县| 桂东县| 宜昌市| 浮梁县| 临猗县| 定兴县| 昌平区| 崇左市| 循化| 库尔勒市| 九龙城区| 横峰县| 互助| 襄樊市| 麻阳| 桑植县| 抚顺县| 巩义市| 庄浪县| 石狮市| 得荣县| 石楼县| 沙洋县|