Skip to content

getter/setter generated for optional enum fields should use OptionΒ #1027

@jmhain

Description

@jmhain

Currently if you have an enum field marked as optional, prost wraps the i32 field in an Option as with other scalar values. However, the generated getter in this case still returns MyEnum instead of Option<MyEnum>, silently converting a None into the default value. This burned me recently, and it's also inconsistent with the fact that the i32 fields are wrapped in Option.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions