From 2aa7bda3cb21ce6c052b82e08bcab79a625d04f2 Mon Sep 17 00:00:00 2001 From: Weicao-CatilGrass <1992414357@qq.com> Date: Sun, 31 May 2026 02:42:52 +0800 Subject: Enhance code quality across the entire codebase --- mingling_core/src/program/collection.rs | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) (limited to 'mingling_core/src/program/collection.rs') diff --git a/mingling_core/src/program/collection.rs b/mingling_core/src/program/collection.rs index ff26411..d3d18d6 100644 --- a/mingling_core/src/program/collection.rs +++ b/mingling_core/src/program/collection.rs @@ -25,23 +25,23 @@ pub trait ProgramCollect { /// Use a prefix tree to quickly match arguments and dispatch to an Entry #[cfg(feature = "dispatch_tree")] fn dispatch_args_trie( - raw: &Vec, + raw: &[String], ) -> Result, crate::error::ProgramInternalExecuteError>; /// Get all registered dispatcher names from the program #[cfg(feature = "dispatch_tree")] fn get_nodes() -> Vec<(String, &'static (dyn Dispatcher + Send + Sync))>; - /// Build an [AnyOutput](./struct.AnyOutput.html) to indicate that a renderer was not found + /// Build an [`AnyOutput`](./struct.AnyOutput.html) to indicate that a renderer was not found fn build_renderer_not_found(member_id: Self::Enum) -> AnyOutput; - /// Build an [AnyOutput](./struct.AnyOutput.html) to indicate that a dispatcher was not found + /// Build an [`AnyOutput`](./struct.AnyOutput.html) to indicate that a dispatcher was not found fn build_dispatcher_not_found(args: Vec) -> AnyOutput; - /// Build an [AnyOutput](./struct.AnyOutput.html) to indicate that the chain returned an empty result + /// Build an [`AnyOutput`](./struct.AnyOutput.html) to indicate that the chain returned an empty result fn build_empty_result() -> AnyOutput; - /// Render the input [AnyOutput](./struct.AnyOutput.html) + /// Render the input [`AnyOutput`](./struct.AnyOutput.html) fn render(any: AnyOutput, r: &mut RenderResult); /// Render help for Entry @@ -53,7 +53,7 @@ pub trait ProgramCollect { any: AnyOutput, ) -> Pin> + Send>>; - /// Find a matching chain to continue execution based on the input [AnyOutput](./struct.AnyOutput.html), returning a new [AnyOutput](./struct.AnyOutput.html) + /// Find a matching chain to continue execution based on the input [`AnyOutput`](./struct.AnyOutput.html), returning a new [`AnyOutput`](./struct.AnyOutput.html) #[cfg(not(feature = "async"))] fn do_chain(any: AnyOutput) -> ChainProcess; @@ -61,13 +61,18 @@ pub trait ProgramCollect { #[cfg(feature = "comp")] fn do_comp(any: &AnyOutput, ctx: &ShellContext) -> Suggest; - /// Whether the program has a renderer that can handle the current [AnyOutput](./struct.AnyOutput.html) + /// Whether the program has a renderer that can handle the current [`AnyOutput`](./struct.AnyOutput.html) fn has_renderer(any: &AnyOutput) -> bool; - /// Whether the program has a chain that can handle the current [AnyOutput](./struct.AnyOutput.html) + /// Whether the program has a chain that can handle the current [`AnyOutput`](./struct.AnyOutput.html) fn has_chain(any: &AnyOutput) -> bool; /// Perform general rendering and presentation of any type + /// + /// # Errors + /// + /// Returns `Err(GeneralRendererSerializeError)` if serialization of the + /// output value fails. #[cfg(feature = "general_renderer")] fn general_render( any: AnyOutput, -- cgit