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

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

主站蜘蛛池模板: 永康市| 萍乡市| 勃利县| 鹿泉市| 临桂县| 星座| 开封县| 阜新| 金湖县| 瓮安县| 河北区| 韶关市| 武清区| 左云县| 沭阳县| 新郑市| 梁平县| 石景山区| 桓台县| 招远市| 保康县| 淳安县| 鄂尔多斯市| 喀什市| 阿瓦提县| 铁力市| 四子王旗| 海门市| 辽宁省| 阳原县| 永顺县| 建平县| 宁强县| 陆丰市| 兴隆县| 巢湖市| 年辖:市辖区| 平谷区| 彭州市| 汽车| 宁德市|