Skip to content

Optimize #[deriving(ToStr)] for C-style enums #7179

Closed
@emberian

Description

@emberian

This would simplify the pattern like

enum Foo {
    A,
    B,
    C
}

fn foo_to_str(f: Foo) -> &'static str {
    match f {
        A => "A",
        B => "B",
        C => "C"
    }
}

instead of doing all the fancy reflection.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-syntaxextArea: Syntax extensionsC-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