Skip to content

Add Zero Trait #3797

Closed
Closed
@mitsuhiko

Description

@mitsuhiko

The core or standard library could probably use a Zero trait that allows certain types to provide a zero value. For instance integers would zero to "0", floats to "0.0", strings to an empty string, bools to false, Options probably to None etc.

What exact types make sense to zero or not is most likely up to discussion. Related to that it might be useful to have a get_or_zero on Option.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-enhancementCategory: An issue proposing an enhancement or a PR with one.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions