cargo doc
Documentation comments use three slashes, ///.We place documentation
comments just before the item we want to document.
Crate Comments //! describes the purpose of my_crate
//! # My Crate
//!
//! `my_crate` is a collection of utilities to make performing certain calculations more convenient.
pub struct test { //Adding description to struct fields
/// a text
a: String,
/// b text
b: String,
}
struct Solution{}
impl Solution {
/// add()
/// # Examples
/// ```
/// let a = 5, b=4;
/// let answer = Solution::add(a, b);
///
/// assert_eq!(9, answer);
/// ```
fn add(a:i32, b:i32)-<i32{
a + b
}
}
fn main() {
println!("Hi");
}
$ cargo doc
Documentation in target\doc
$ cargo doc --open //Will open Front page of create root
$ cargo test add() //This will run test case in documentation