5.注释.rs
/// 這種事第二類注釋,用于說明本模塊的功能。一般置于模塊文件的頭部。(好像必須放在頭部)///
//! note: inner doc comments like this (starting with `//!` or `/*!`) can only appear before items
//! # The Rust Standard Library
//!
//! The Rust Standard Library provides the essential runtime
//! functionality for building portable Rust software.第一類是常規(guī)注釋,這類注釋在編譯的時候被忽略掉
// 這是第一種注釋方式/* 這是第二種注釋方式 */ /* * 多行注釋* 多行注釋* 多行注釋*/ 第二類是文檔注釋,用于通過工具生成HTML API文檔
/// 作為說明文檔注釋的開頭:
///?Adds?one?to?the?number?given.
///
///?#?Examples
///
///?```
///?let x = add(1, 2);
///
///?```
fn add(a: i32, b: i32) -> i32 { return a + b;
} fn main() {}
?
總結(jié)
- 上一篇: 4.extern关键字.rs
- 下一篇: 6.变量的使用.rs