Advertisement
Guest User

Untitled

a guest
Dec 8th, 2016
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.29 KB | None | 0 0
  1. macro_rules! defn {
  2. ($x:ident ($($a:ident: $t:ty),*) -> $ot:ty $body:block) => {
  3. const FUNC_NAME: &'static str = stringify!($x);
  4. fn $x ($($a: $t),*) -> $ot $body
  5. }
  6. }
  7.  
  8. defn! { fun () -> &'static str {
  9. FUNC_NAME
  10. } }
  11.  
  12. pub fn main() {
  13. println!("fun: {}", fun());
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement