Files
RedBear-OS/src/common/mod.rs
T

28 lines
752 B
Rust

#[macro_use]
pub mod int_like;
pub mod unique;
/// Debug macro, lifted from the std
#[macro_export]
macro_rules! dbg {
() => {
$crate::println!("[{}:{}]", file!(), line!());
};
($val:expr) => {
// Use of `match` here is intentional because it affects the lifetimes
// of temporaries - https://stackoverflow.com/a/48732525/1063961
match $val {
tmp => {
$crate::println!("[{}:{}] {} = {:#?}",
file!(), line!(), stringify!($val), &tmp);
tmp
}
}
};
// Trailing comma with single argument is ignored
($val:expr,) => { $crate::dbg!($val) };
($($val:expr),+ $(,)?) => {
($($crate::dbg!($val)),+,)
};
}