Skip to content

Conversation

@lexeyOK
Copy link
Contributor

@lexeyOK lexeyOK commented Dec 8, 2025

this pr adds optimisations and syntax improvements for the block! macro

this commit adds build.rs which makes phf map allowing to speed up the
calculation of the blockid
this commit adds placeholder feature and restructures the parsing to
allow _ and ident in property's value.
this follows Struct patterns more closely
updates phf to 0.13 and makes block makro use workspace version
@lexeyOK lexeyOK force-pushed the fix/clean-block-macro-speedup branch from 9123abb to 39ceafc Compare December 8, 2025 17:58
updates phf to 0.13 and makes block makro use workspace version
@lexeyOK lexeyOK marked this pull request as ready for review December 8, 2025 18:12
use ferrumc_macros::block;
#[derive(Debug, PartialEq, Eq)]
struct BlockStateId(u32);
#[cfg(false)]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this was a test what uses all blockstates but you said i shouldn't add it since it's too long to compile, it's useful for me to check itacro is working but it also generates a lot of unnecessary functions so I disable it completely

/// If the block or properties are invalid, a compile-time error will be thrown that should hopefully
/// explain the issue.
/// # Static block
/// gives a single block pat. Mainly used with
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add some examples with what you mean by this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i guess it's showing the distinction between having block with and without properties, if it has any properties they must be used or skiped explicitly, similar to how mattern matching works on structs I don't really know what to write here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants