• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #[macro_export]
2 macro_rules! show {
3     ($expression: expr) => {
4         println!("{:?}", $expression);
5     };
6     ($expression: expr, $($next: expr),+) => {{
7         print!("{:?} ", $expression);
8         show!($($next),+)
9     }};
10     // Ignore a trailing comma:
11     ($($expression: expr),+,) => {
12         show!($($expression),+)
13     };
14 }
15 
16 #[test]
it_works()17 fn it_works() {
18     show!("foo",);
19     show!(Some(42i32));
20     show!(4u8, 'x', ("a", "b"));
21     //panic!()  // Uncomment to see test output.
22 }
23