Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- macro_rules! defn {
- ($x:ident ($($a:ident: $t:ty),*) -> $ot:ty $body:block) => {
- const FUNC_NAME: &'static str = stringify!($x);
- fn $x ($($a: $t),*) -> $ot $body
- }
- }
- defn! { fun () -> &'static str {
- FUNC_NAME
- } }
- pub fn main() {
- println!("fun: {}", fun());
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement