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

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.

主站蜘蛛池模板: 绥化市| 衡东县| 水城县| 石城县| 庆城县| 瑞昌市| 嵩明县| 城固县| 辽源市| 宜川县| 句容市| 阿荣旗| 凤山市| 曲沃县| 淳化县| 会东县| 当阳市| 深水埗区| 平罗县| 莲花县| 丹寨县| 乐亭县| 新乐市| 安阳县| 湛江市| 东丽区| 永康市| 横山县| 长沙市| 平谷区| 灯塔市| 大埔县| 汝南县| 福州市| 右玉县| 雷波县| 视频| 武城县| 永寿县| 西宁市| 香河县|