Skip to content

Add CTFE function for enum types to return the number of variants. #8803

Closed
@tikue

Description

@tikue

This would allow for something like this:

enum Foo {
    A,
    B,
}

static two: uint = Foo::len();
assert!(two == 2u);

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