From 719b92782bd87659c62bea92365ad211a5f4569f Mon Sep 17 00:00:00 2001 From: 魏曹先生 <1992414357@qq.com> Date: Fri, 14 Aug 2026 04:00:06 +0800 Subject: chore: add doc comment for MockProgramCollect --- mingling_core/src/program/collection/mock.rs | 29 +++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/mingling_core/src/program/collection/mock.rs b/mingling_core/src/program/collection/mock.rs index b8d881e..634d529 100644 --- a/mingling_core/src/program/collection/mock.rs +++ b/mingling_core/src/program/collection/mock.rs @@ -1,21 +1,40 @@ -// Doc Not Optimize +use crate::{AnyOutput, ChainProcess, Grouped, ProgramCollect, RenderResult}; + #[cfg(feature = "async")] use std::pin::Pin; #[cfg(feature = "dispatch_tree")] use crate::Dispatcher; -use crate::{AnyOutput, ChainProcess, Grouped, ProgramCollect, RenderResult}; +#[cfg(feature = "comp")] +use crate::{ShellContext, Suggest}; #[cfg(feature = "structural_renderer")] use crate::{StructuralRendererSetting, error::StructuralRendererSerializeError}; -#[cfg(feature = "comp")] -use crate::{ShellContext, Suggest}; - #[cfg(feature = "structural_renderer")] use serde::Serialize; +/// Used to simulate the types generated by the `gen_program!` macro in examples and tests. +/// +/// It can be referenced in documentation using the following code: +/// +/// ```rust,ignore +/// use mingling_core::MockProgramCollect as ThisProgram; +/// ``` +/// +/// This enum is for development and testing purposes only and should not be used in production code. +/// It simulates the program enum type generated by the `gen_program!` macro, allowing examples, unit tests, and doctests to work without actual macro expansion. +/// +/// # Variants +/// +/// - `Foo` — Simulates the first program node ID of the program. +/// - `Bar` — Simulates the second program node ID of the program. +/// +/// # Safety Notes +/// +/// This type implements the `ProgramCollect` trait, but all actual methods are implemented via `unreachable!()` or `panic!`, +/// ensuring it will never be called in a real macro system. It is only used to satisfy trait bounds so that type checking passes at compile time. #[cfg_attr(feature = "structural_renderer", derive(Serialize))] #[allow(unused)] #[doc(hidden)] -- cgit