aboutsummaryrefslogtreecommitdiff
path: root/mingling/src/lib.rs
diff options
context:
space:
mode:
author魏曹先生 <1992414357@qq.com>2026-06-26 06:08:12 +0800
committer魏曹先生 <1992414357@qq.com>2026-06-26 06:08:12 +0800
commite735671acb3a81e1b7e334e56b9ef3963ba0c2fc (patch)
tree46562d6630bb1582b41b6741a7a4f482febf84da /mingling/src/lib.rs
parent473cd8e575d03d8bd5439e81cb6835f56a1e964f (diff)
feat(core): decouple structured output from Groupped trait
Introduce `StructuralData` sealed trait and `pack_structural!` / `group_structural!` / `derive(StructuralData)` macros to control structured rendering separately from grouping. `Groupped` no longer requires `Serialize`.
Diffstat (limited to 'mingling/src/lib.rs')
-rw-r--r--mingling/src/lib.rs19
1 files changed, 19 insertions, 0 deletions
diff --git a/mingling/src/lib.rs b/mingling/src/lib.rs
index 70b69bc..4c49f15 100644
--- a/mingling/src/lib.rs
+++ b/mingling/src/lib.rs
@@ -96,15 +96,24 @@ pub mod macros {
/// Used to register an external type as a group member
#[cfg(feature = "extra_macros")]
pub use mingling_macros::group;
+ /// Like `group!` but also marks the type for structured output
+ #[cfg(all(feature = "general_renderer", feature = "extra_macros"))]
+ pub use mingling_macros::group_structural;
/// Used to generate a struct implementing the `HelpRequest` trait via a method
pub use mingling_macros::help;
/// Used to create a `Node` struct via a literal
pub use mingling_macros::node;
/// Used to create a wrapper type for use with `Chain` and `Renderer`
pub use mingling_macros::pack;
+ /// Like `pack!` but also marks the type for structured output
+ #[cfg(feature = "general_renderer")]
+ pub use mingling_macros::pack_structural;
/// Used to create an error struct with automatic `name` field
#[cfg(feature = "extra_macros")]
pub use mingling_macros::pack_err;
+ /// Like `pack_err!` but also marks the type for structured output
+ #[cfg(all(feature = "general_renderer", feature = "extra_macros"))]
+ pub use mingling_macros::pack_err_structural;
#[cfg(feature = "comp")]
#[doc(hidden)]
pub use mingling_macros::program_comp_gen;
@@ -148,6 +157,10 @@ pub use mingling_macros::EnumTag;
/// derive macro Groupped
pub use mingling_macros::Groupped;
+/// derive macro `StructuralData` — marks a type as supporting structured output
+#[cfg(feature = "general_renderer")]
+pub use mingling_macros::StructuralData;
+
/// Example projects for `Mingling`, for learning how to use `Mingling`
pub mod _mingling_examples {
pub use crate::example_docs::*;
@@ -200,9 +213,15 @@ pub mod prelude {
pub use crate::macros::gen_program;
/// Re-export of the `pack` macro for creating wrapper types.
pub use crate::macros::pack;
+ /// Like `pack!` but also marks the type for structured output
+ #[cfg(feature = "general_renderer")]
+ pub use mingling_macros::pack_structural;
/// Re-export of the `pack_err` macro for creating error types.
#[cfg(feature = "extra_macros")]
pub use crate::macros::pack_err;
+ /// Like `pack_err!` but also marks the type for structured output
+ #[cfg(all(feature = "general_renderer", feature = "extra_macros"))]
+ pub use mingling_macros::pack_err_structural;
/// Re-export of the `r_print` macro for printing within a renderer context.
pub use crate::macros::r_print;
/// Re-export of the `r_println` macro for printing with a newline within a renderer