diff options
| author | Charles Johnson <32775248+ChemicalXandco@users.noreply.github.com> | 2023-02-09 17:18:56 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-02-09 11:18:56 -0600 |
| commit | 48b2a37aa09f0302b40d0678cdde2703f919ed18 (patch) | |
| tree | 14354705cfd342c58bb93b80f26de2246da5494c /azalea-block/azalea-block-macros/src | |
| parent | c23fae6e5dc2832f3649838f514eafb9dfa3e598 (diff) | |
| download | azalea-drasl-48b2a37aa09f0302b40d0678cdde2703f919ed18.tar.xz | |
derive `Debug` for `BlockState` (#64)
* derive `Debug` for `BlockState`
* change default Debug for BlockState
---------
Co-authored-by: Ubuntu <github@matdoes.dev>
Diffstat (limited to 'azalea-block/azalea-block-macros/src')
| -rwxr-xr-x | azalea-block/azalea-block-macros/src/lib.rs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/azalea-block/azalea-block-macros/src/lib.rs b/azalea-block/azalea-block-macros/src/lib.rs index bbd98619..7e304d57 100755 --- a/azalea-block/azalea-block-macros/src/lib.rs +++ b/azalea-block/azalea-block-macros/src/lib.rs @@ -563,6 +563,8 @@ pub fn make_block_states(input: TokenStream) -> TokenStream { #[repr(u32)] #[derive(Copy, Clone, PartialEq, Eq)] + // the Debug impl is very large and slows down compilation + #[cfg_attr(feature = "full-debug", derive(Debug))] pub enum BlockState { #block_state_enum_variants } @@ -575,10 +577,10 @@ pub fn make_block_states(input: TokenStream) -> TokenStream { } } + #[cfg(not(feature = "full-debug"))] impl std::fmt::Debug for BlockState { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - // having a big match statement here would take up 700kb - f.write_str("BlockState") + write!(f, "BlockState ({})", Box::<dyn Block>::from(*self).id()) } } }; |
