Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add derive macros for TypstPath and TypstFunc #16

Merged
merged 5 commits into from
Sep 23, 2024

Conversation

feathecutie
Copy link
Contributor

@feathecutie feathecutie commented Sep 21, 2024

I tried tackling adding proc macros for TypstFunc and TypstPath.
I'm not really sure about the quality of this code because I've never really worked with proc macros before, but I tried writing it to be as readable as possible.

From my testing, everything seems to work as expected.

This PR uses the darling library for most of the heavy parsing which reduces the code length by a lot, but it does result in code which feels a lot more like "magic" which might not be desirable.

Closes #9, closes #8.

Copy link
Member

@nixon-voxell nixon-voxell left a comment

Choose a reason for hiding this comment

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

I haven't tested the functionality yet, but overall looks really promising! I suggested some changes that could make the API much easier to use haha. I'm open to ideas as well, do let me know if you have any!

crates/velyst_macros/src/lib.rs Show resolved Hide resolved
crates/velyst_macros/src/lib.rs Show resolved Hide resolved
@nixon-voxell nixon-voxell self-requested a review September 23, 2024 06:17
Copy link
Member

@nixon-voxell nixon-voxell left a comment

Choose a reason for hiding this comment

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

Tested it and it works great! Added some macro hygiene and used it for the examples! Thanks a bunch!

@nixon-voxell nixon-voxell merged commit 7747601 into voxell-tech:main Sep 23, 2024
7 checks passed
@nixon-voxell nixon-voxell added the enhancement New feature or request label Sep 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Macro for TypstFunc Macro for TypstPath
2 participants