mirror of
https://github.com/Noratrieb/dilaria.git
synced 2026-01-14 17:35:03 +01:00
test out better debugging
This commit is contained in:
parent
6a8eb89381
commit
5f9ca90fd5
13 changed files with 422 additions and 145 deletions
13
src/util.rs
13
src/util.rs
|
|
@ -1,9 +1,20 @@
|
|||
/// Statically asserts that the size of the type is x bytes big (on 64-bit)
|
||||
macro_rules! assert_size {
|
||||
($name:ident == $size:expr) => {
|
||||
($name:ident <= $size:expr) => {
|
||||
#[cfg(target_pointer_width = "64")]
|
||||
const _: [(); $size] = [(); ::std::mem::size_of::<$name>()];
|
||||
};
|
||||
}
|
||||
|
||||
pub(crate) use assert_size;
|
||||
use std::fmt::Display;
|
||||
|
||||
#[cfg(feature = "_debug")]
|
||||
pub fn dbg(prefix: impl Display, x: impl dbg_pls::DebugPls) {
|
||||
eprintln!("{prefix}{}", dbg_pls::pretty(&x))
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "_debug"))]
|
||||
pub fn dbg(prefix: impl Display, x: impl std::fmt::Debug) {
|
||||
eprintln!("{prefix}{x:#?}");
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue