Skip to content

Enumeration are not idomatic #13

@Guiguiprim

Description

@Guiguiprim

It is recommended to prefix enum variant with the enum name in ptotobuf for better support in some languages as such:

enum RuleLevel {
    RULE_LEVEL_UNKNOWN = 0;
    RULE_LEVEL_INFORMATIONAL = 1;
    RULE_LEVEL_LOW = 3;
    RULE_LEVEL_MEDIUM = 4;
    RULE_LEVEL_HIGH = 5;
    RULE_LEVEL_CRITICAL = 6;
}

But in Rust it would be more idomatic to remove the prefix and CamelCase the variant as such:

enum RuleLevel {
    Unknown,
    Informational,
    Low,
    Medium,
    High,
    Critical,
}

This is what prost does for example.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions