Skip to content

Instantly share code, notes, and snippets.

@KeenS
Created August 14, 2018 14:37
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 KeenS/24bf5337c6c1232451322e1948a53055 to your computer and use it in GitHub Desktop.
Save KeenS/24bf5337c6c1232451322e1948a53055 to your computer and use it in GitHub Desktop.
//! 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