From 17cf59fe8220ac5befbbe8333fa0515ab532103d Mon Sep 17 00:00:00 2001 From: 魏曹先生 <1992414357@qq.com> Date: Mon, 13 Apr 2026 21:19:03 +0800 Subject: Remove comp module and add EnumTag derive macro --- mingling_core/src/asset.rs | 3 +++ mingling_core/src/asset/enum_tag.rs | 11 +++++++++++ mingling_core/src/lib.rs | 1 + 3 files changed, 15 insertions(+) create mode 100644 mingling_core/src/asset/enum_tag.rs (limited to 'mingling_core') diff --git a/mingling_core/src/asset.rs b/mingling_core/src/asset.rs index 1270a50..a4254ef 100644 --- a/mingling_core/src/asset.rs +++ b/mingling_core/src/asset.rs @@ -8,6 +8,9 @@ pub mod comp; #[doc(hidden)] pub mod dispatcher; +#[doc(hidden)] +pub mod enum_tag; + #[doc(hidden)] pub mod node; diff --git a/mingling_core/src/asset/enum_tag.rs b/mingling_core/src/asset/enum_tag.rs new file mode 100644 index 0000000..563d826 --- /dev/null +++ b/mingling_core/src/asset/enum_tag.rs @@ -0,0 +1,11 @@ +/// Marker trait for EnumTag +pub trait EnumTag { + /// Get the name and description of this enum + fn enum_info(&self) -> (&'static str, &'static str); + + /// Get all possible enum variant names and descriptions + fn enums() -> &'static [(&'static str, &'static str)]; + + /// Build the enum from a name + fn build_enum(name: String) -> Self; +} diff --git a/mingling_core/src/lib.rs b/mingling_core/src/lib.rs index 2c5cf55..87be806 100644 --- a/mingling_core/src/lib.rs +++ b/mingling_core/src/lib.rs @@ -24,6 +24,7 @@ pub use crate::asset::chain::*; #[cfg(feature = "comp")] pub use crate::asset::comp::*; pub use crate::asset::dispatcher::*; +pub use crate::asset::enum_tag::*; pub use crate::asset::node::*; pub use crate::asset::renderer::*; -- cgit