Draft
Conversation
This makes macro invocations free at runtime, whereas the old macro delegated to from_str at runtime which has small but nonzero cost. The concept is based on alkis#16 but completely rewritten with the newer (stable) procedural macros which implies a requirement for rustc 1.31.0 (2018 edition). The implementation uses the 2021 edition (rustc 1.56.0) for convenience.
Open
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is basically a rewrite of #16 using procedural macros which were stabilized in the 2018 edition (rustc 1.31.0).
There are a few things that I haven't addressed yet, since I wanted to propose the concept before spending too much time on it:
decimallibrary can't export the new macro because the macro depends on it. This could be fixed by moving the existing implementation into adecimal-corecrate, and makingdecimala thin facade that re-exports everything fromdecimal-corealongside the macro fromdecimal-macros.to_raw_bytesandfrom_raw_byteson different architectures.proc_macro2which I haven't done. At that point usingquoteto generate token streams might be easier (which I haven't done because not using it keeps the dependency count down).