Skip to content

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