Skip to content

Adds new macro to specify enum configurations with custom option name… #201

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

rjd15372
Copy link
Member

… 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:

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.

… 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 <[email protected]>
@rjd15372
Copy link
Member Author

I'm open for suggestions regarding the new macro name!

@rjd15372
Copy link
Member Author

rjd15372 commented May 2, 2025

@dmitrypol FYI, I'm using this new macro in the development of https://github.com/rjd15372/valkey-ldap .

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.

1 participant