Skip to content

Instantly share code, notes, and snippets.

@toshimasa-nanaki
Created December 23, 2018 14:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save toshimasa-nanaki/62547e79c02933830531ab3f8f6989e1 to your computer and use it in GitHub Desktop.
Save toshimasa-nanaki/62547e79c02933830531ab3f8f6989e1 to your computer and use it in GitHub Desktop.
Rust ドキュメンテーション生成用サンプル
/// メイン関数
/// 標準入力を求め、入力された文字にビックリマークをつけて返す
pub fn main() {
let mut s = String::new();
std::io::stdin().read_line(&mut s).ok();
println!("{}",public_function(s.trim().parse().ok().unwrap()));
}
/// これはパブリックな関数
/// 渡された文字列の後ろにビックリマークをつけて返す
pub fn public_function(word : String) -> String {
private_function(word)
}
/// これはプライベートな関数
/// Hello Worldの後ろにビックリマークをつける
fn private_function(word : String) -> String {
word + "!"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment