mirror of
https://github.com/Noratrieb/dilaria.git
synced 2026-01-14 09:25:02 +01:00
21 lines
583 B
Rust
21 lines
583 B
Rust
/// Statically asserts that the size of the type is x bytes big (on 64-bit)
|
|
macro_rules! assert_size {
|
|
($name:ident <= $size:expr) => {
|
|
#[cfg(target_pointer_width = "64")]
|
|
const _: [(); $size] = [(); ::std::mem::size_of::<$name>()];
|
|
};
|
|
}
|
|
|
|
use std::fmt::Display;
|
|
|
|
pub(crate) use assert_size;
|
|
|
|
#[cfg(feature = "_debug")]
|
|
pub fn dbg(prefix: impl Display, x: impl dbg_pls::DebugPls) {
|
|
eprintln!("{prefix}{}", dbg_pls::color(&x))
|
|
}
|
|
|
|
#[cfg(not(feature = "_debug"))]
|
|
pub fn dbg(prefix: impl Display, x: impl std::fmt::Debug) {
|
|
eprintln!("{prefix}{x:#?}");
|
|
}
|