Created
August 14, 2018 14:37
-
-
Save KeenS/24bf5337c6c1232451322e1948a53055 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//! parent level doc comments | |
mod path { | |
/*! parent level doc comment2 */ | |
pub mod name { | |
pub type Type = String; | |
pub const CONSTANT: &'static str = "const"; | |
} | |
} | |
/// doc comment | |
fn function_name<'lifetime>(symbol1: &'lifetime self::path::name::Type) -> &'lifetime str { | |
// simple comment | |
let symbol2 = "hoge"; | |
'label: loop { | |
break 'label; | |
} | |
/* comment 2 */ | |
symbol2 | |
} | |
/** doc comment 2 */ | |
#[derive(Debug, Clone)] | |
enum Enum { | |
Variant, | |
} | |
#[derive(Debug, Clone)] | |
struct Struct { | |
symbol3: Enum, | |
} | |
impl Struct { | |
fn method_name(&self) {} | |
} | |
macro_rules! macro_name { | |
($macro_var:expr) => { | |
$macro_var | |
}; | |
} | |
fn main() { | |
let struct1 = Struct { | |
symbol3: Enum::Variant, | |
}; | |
struct1.method_name(); | |
let fuga = "fuga".to_string(); | |
// `str` as variable name | |
let str = macro_name!(function_name(&fuga)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment