Rust: doc and comment
Doc command line:
Build docs
>Cargo doc
Build docs and open in the browser
>Cargo doc --open
Rust comment:
Inner comment:
// this is a line-comment
/*
This is a block-comment
/*
Outer comment: display in docs
/// outer comment1
//! outer comment2
Outer comment support Markdown Syntax:
Multiple head-level:
#head1,##head2,###head3
粗体/斜体:
*斜体*,**粗体**,***粗斜体***
强调:
`强调内容`
链接:
[字面量](path)
图片链接:
![字面量](path “图片 title”)
Example:
///describe foo function here
///
/// > # markdown syntax here:
/// # head1
/// ## head2
/// ### head3...
///
/// *斜体*
///
/// **粗体**
///
/// ***粗斜体***
///
/// `强调`
///
/// 这是一个链接 :[Markdown语法](https://markdown.com.cn)
///
/// ![这是图片](https://img1.446677.xyz/2021/01/12/8a7fefde9beb29d86a5a1db99eb77a9f.jpg "picture title here:")
///
/// Try to put a blank line before...
///
/// ---
///
/// ...and after a horizontal rule.
///
///# example
/// ```
/// //代码段
/// let ret=foo("hello world",100);
/// ```
pub fn foo(arg1:String,arg2:i32)->bool{
//! this will be show in docs
// line-comment
/*
block-comment
*/
println!("arg1={},arg2={}",arg1,arg2);
return true;
}