1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#![deny(missing_docs)]

//! A lightweight library for quickly debugging rust code.

/// Logs the file, line number, and expressions along with their `Show` value.
///
/// # Examples
///
/// ```
/// # #[macro_use(inspect)]
/// # extern crate inspect;
/// fn main() {
///     let a = 7u;
///     inspect!(a, a + 4); //=> file.rs - X: a = 7, a + 4 = 11
/// }
/// ```
///
#[macro_export]
macro_rules! inspect(
    ($($a:expr),*) => {
        println!(
            "{} - {}: {}",
            file!(), line!(),
            format!(
                concat!($(stringify!($a), " = {}, "),*), $($a),*
            )
        );
    }
);