Skip to content

Allow non-exhaustive bitenum fields to be either a Result<T> or Option<T> #35

@vortexofdoom

Description

@vortexofdoom

Currently the bitfield macro requires that non-exhaustive enums be wrapped in an Option, but the generated methods return a Result, which I think is unintuitive.

I'd propose that we either require that they be wrapped as a Result, that we change the methods to return an Option (essentially ignoring invalid values when called) or provide support for either.

I can definitely see the value in knowing what the invalid value was, but sometimes an invalid bit configuration is closer in meaning to None than Err, so it'd be cool to include that.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions