summaryrefslogtreecommitdiff
path: root/meap/meap-code/ch3/ch3-anystring-macro.rs
blob: 7500e9587d30d20dd1a89ec39728c67ad08de68e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
macro_rules! string {
    ($x:expr) => ( // <1>
        String::from(stringify!($x)); // <2>
    )
}

fn main() {
    let s = string!(hello there);
    println!("{}", s);
}