Add support for const_into_str attribute to enable static string conversions in const contexts#353
Merged
Peternator7 merged 5 commits intoPeternator7:masterfrom Nov 25, 2024
Conversation
…nversions in const contexts resolves: Peternator7#352
Contributor
Author
|
@Peternator7 could you check it out? |
Owner
|
Seems reasonable to me, could you add a test case? |
Contributor
Author
Added |
|
Could someone on the team merge this? |
Contributor
Author
|
@Peternator7 could you take a look? |
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 pull request introduces the
const_into_strattribute to thestrummacros, enabling enums to be converted into static strings in const contexts. This feature is particularly useful when working with compile-time string manipulations, such as those required byconcatcp.Key Changes:
const_into_strkeyword in enum metadata processing.const fn into_str()method for enums marked withconst_into_str.Fromtrait to utilizeinto_str()whenconst_into_stris enabled.The implementation ensures that existing functionality is preserved and provides users with the option to opt into this new feature as needed. This feature could be especially beneficial for users needing efficient, compile-time safe string operations involving enums.
Please review the changes and let me know if there are any modifications or improvements required.
resolves #352