标签:rust rustdoc mozilla 注释 rust语言
既然已经学习了函数,学习注释是个不错的主意。注释是你留给其他程序员帮助介绍你的代码的笔记。编译器将绝大部分的忽略他们。// Line comments are anything after ‘//’ and extend to the end of the line. let x = 5; // this is also a line comment. // If you have a long explanation for something, you can put line comments next // to each other. Put a space between the // and your comment so that it’s // more readable.
/// Adds one to the number given. /// /// # Examples /// /// ``` /// let five = 5; /// /// assert_eq!(6, add_one(5)); /// ``` fn add_one(x: i32) -> i32 { x + 1 }
标签:rust rustdoc mozilla 注释 rust语言
原文地址:http://blog.csdn.net/ucan23/article/details/45725677