Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a new macro argument for enums to change a flag value #282

Open
zhiburt opened this issue Feb 10, 2023 · 1 comment
Open

Add a new macro argument for enums to change a flag value #282

zhiburt opened this issue Feb 10, 2023 · 1 comment
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@zhiburt
Copy link
Owner

zhiburt commented Feb 10, 2023

#[derive(Tabled)]
enum Domain {
    Security,
    Embedded,
    Frontend,
    Unknown,
}
     
let data = vec![
    Domain::Embedded,
    Domain::Security,
    Domain::Frontend,
    Domain::Unknown,
];
  
assert_eq!(
    table,
    concat!(
        " Security | Embedded | Frontend | Unknown \n",
        "----------+----------+----------+---------\n",
        "          |    +     |          |         \n",
        "    +     |          |          |         \n",
        "          |          |    +     |         \n",
        "          |          |          |    +    "
    )
);

The idea is to change this +.
I do not know what the perfect name for it.

But we surely could support with_display which is currently not suported for enum as I understand.

@zhiburt zhiburt added enhancement New feature or request good first issue Good for newcomers labels Feb 10, 2023
@zhiburt zhiburt changed the title Add a new derive_macro argument for enums to set a flag value Add a new marcro argument for enums to set a flag value Feb 10, 2023
@zhiburt zhiburt changed the title Add a new marcro argument for enums to set a flag value Add a new macro argument for enums to set a flag value Feb 10, 2023
@zhiburt zhiburt changed the title Add a new macro argument for enums to set a flag value Add a new macro argument for enums to change a flag value Feb 10, 2023
@zhiburt
Copy link
Owner Author

zhiburt commented Feb 17, 2023

By the way I guess we could add a logic switch of how to represent enum.

As we could use just its variant name instead of this verse + logic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant