Adds new macro to specify enum configurations with custom option name…#201
Open
rjd15372 wants to merge 1 commit intovalkey-io:mainfrom
Open
Adds new macro to specify enum configurations with custom option name…#201rjd15372 wants to merge 1 commit intovalkey-io:mainfrom
rjd15372 wants to merge 1 commit intovalkey-io:mainfrom
Conversation
… strings
This commit introduces a new macro definition called
`enum_configuration2` to help with declaring a enum configuration type
where the developer can specify a custom option name string in the enum
option value.
Example:
```rust
enum_configuration2! {
#[derive(PartialEq)]
enum EnumConfiguration2 {
Val1 = ("val_1", 1),
Val2 = ("val_2", 2),
}
}
```
The enum option value string accepted by the `CONFIG SET` command will be
`val_1` or `val_2` instead of `Val1` or `Val2` as in when declaring the
enum type with the `enum_configuration` macro.
This commit also fixes a bug in the `enum_configuration` macro, which
would not allow the macro to be used twice in the same file.
Signed-off-by: Ricardo Dias <ricardo.dias@percona.com>
Member
Author
|
I'm open for suggestions regarding the new macro name! |
Member
Author
|
@dmitrypol FYI, I'm using this new macro in the development of https://github.com/rjd15372/valkey-ldap . |
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.
… strings
This commit introduces a new macro definition called
enum_configuration2to help with declaring a enum configuration type where the developer can specify a custom option name string in the enum option value.Example:
The enum option value string accepted by the
CONFIG SETcommand will beval_1orval_2instead ofVal1orVal2as in when declaring the enum type with theenum_configurationmacro.This commit also fixes a bug in the
enum_configurationmacro, which would not allow the macro to be used twice in the same file.