|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#[macro_export] |
|
|
macro_rules! vdbg { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
() => { |
|
|
eprintln!("[{}:{}]", file!(), line!()) |
|
|
}; |
|
|
|
|
|
(__init $depth:expr ; [ $val:expr $(, $rest:expr)* ] [ $($tt:tt)* ] ) => { |
|
|
{ |
|
|
let valstr = stringify!($val); |
|
|
|
|
|
|
|
|
let valmove = $val; |
|
|
|
|
|
|
|
|
|
|
|
let valowned = valmove.to_owned(); |
|
|
$crate::vdbg!(__init $depth ; [ $($rest),* ] [ $($tt)* valstr valmove valowned ]) |
|
|
} |
|
|
}; |
|
|
(__init $depth:expr ; [ ] [ $($valstr:ident $valmove:ident $valowned:ident)* ] ) => { |
|
|
{ |
|
|
use $crate::debug::ValueDebugFormat; |
|
|
let depth = $depth; |
|
|
$crate::macro_helpers::spawn_detached_for_testing(async move { |
|
|
$crate::vdbg!(__expand depth ; [ $($valstr $valowned)* ] []); |
|
|
Ok(()) |
|
|
}); |
|
|
($($valmove),*) |
|
|
} |
|
|
}; |
|
|
|
|
|
(__expand $depth:ident ; [ $valstr:ident $val:ident $($rest:tt)* ] [ $($tt:tt)* ]) => { |
|
|
let valdbg = (&$val).value_debug_format($depth).try_to_string().await?; |
|
|
$crate::vdbg!(__expand $depth ; [ $($rest)* ] [ $($tt)* $valstr valdbg ]); |
|
|
}; |
|
|
(__expand $depth:ident ; [] [ $( $valstr:ident $valdbg:ident )* ]) => { |
|
|
|
|
|
|
|
|
|
|
|
eprint!( |
|
|
$crate::vdbg!(__repeat "[{file}:{line}] {} = {}\n" $($valstr)*), |
|
|
$( |
|
|
$valstr, |
|
|
$valdbg, |
|
|
)* |
|
|
file = file!(), |
|
|
line = line!(), |
|
|
); |
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
(__repeat $str:literal $x:ident $($rest:ident)*) => { concat!($str, $crate::vdbg!(__repeat $str $($rest)*)) }; |
|
|
(__repeat $str:literal) => { "" }; |
|
|
|
|
|
($($val:expr),* ; depth = $depth:expr) => { |
|
|
$crate::vdbg!(__init $depth ; [ $($val),* ] []) |
|
|
}; |
|
|
($($val:expr),+ $(,)?) => { |
|
|
$crate::vdbg!(__init usize::MAX ; [ $($val),* ] []) |
|
|
}; |
|
|
} |
|
|
|