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

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.

主站蜘蛛池模板: 榆社县| 新和县| 米易县| 疏勒县| 延安市| 白山市| 长寿区| 贵州省| 大宁县| 巴楚县| 石家庄市| 杨浦区| 宁晋县| 石门县| 屏东市| 长治市| 双柏县| 茂名市| 左云县| 乐安县| 庆元县| 长宁区| 扎赉特旗| 巴楚县| 靖边县| 昌江| 东莞市| 玉屏| 玉林市| 漳平市| 蚌埠市| 潮安县| 来安县| 秭归县| 宁阳县| 军事| 友谊县| 上杭县| 大余县| 北碚区| 连江县|