refactor: Created a derive macro for defining the display style of Enum models and removed the use of the EnumDisplayStyle trait

This commit is contained in:
2025-03-06 15:29:30 -07:00
parent 7381eaef57
commit f97d46cec3
20 changed files with 305 additions and 271 deletions
+15
View File
@@ -0,0 +1,15 @@
use enum_display_style_derive::EnumDisplayStyle;
use pretty_assertions::assert_str_eq;
#[test]
fn test_derive_enum_display_style() {
assert_str_eq!(TestEnum::Test.to_display_str(), "Testing 123");
assert_str_eq!(TestEnum::Ignored.to_display_str(), "Ignored");
}
#[derive(EnumDisplayStyle)]
pub enum TestEnum {
#[display_style(name = "Testing 123")]
Test,
Ignored,
}