From f27f5aeb09616b932ab48f0905994879dd8bafe5 Mon Sep 17 00:00:00 2001 From: Weicao-CatilGrass <1992414357@qq.com> Date: Sun, 17 May 2026 22:30:50 +0800 Subject: Rename `NextProcess` to `Next` across the codebase --- mingling_core/src/any.rs | 20 ++++++++++---------- mingling_core/src/program/exec.rs | 10 +++++----- mingling_core/src/tester/chain_process_tester.rs | 4 ++-- 3 files changed, 17 insertions(+), 17 deletions(-) (limited to 'mingling_core/src') diff --git a/mingling_core/src/any.rs b/mingling_core/src/any.rs index 21611a7..b8ff7b2 100644 --- a/mingling_core/src/any.rs +++ b/mingling_core/src/any.rs @@ -66,12 +66,12 @@ impl AnyOutput { /// Route the output to the next Chain pub fn route_chain(self) -> ChainProcess { - ChainProcess::Ok((self, Next::Chain)) + ChainProcess::Ok((self, NextProcess::Chain)) } /// Route the output to the Renderer, ending execution pub fn route_renderer(self) -> ChainProcess { - ChainProcess::Ok((self, Next::Renderer)) + ChainProcess::Ok((self, NextProcess::Renderer)) } #[cfg(feature = "general_renderer")] @@ -105,11 +105,11 @@ impl std::ops::DerefMut for AnyOutput { /// Chain exec result type /// /// Stores `Ok` and `Err` types of execution results, used to notify the scheduler what to execute next -/// - Returns `Ok((`[`AnyOutput`](./struct.AnyOutput.html)`, `[`Next::Chain`](./enum.Next.html)`))` to continue execution with this type next -/// - Returns `Ok((`[`AnyOutput`](./struct.AnyOutput.html)`, `[`Next::Renderer`](./enum.Next.html)`))` to render this type next and output to the terminal +/// - Returns `Ok((`[`AnyOutput`](./struct.AnyOutput.html)`, `[`NextProcess::Chain`](./enum.NextProcess.html)`))` to continue execution with this type next +/// - Returns `Ok((`[`AnyOutput`](./struct.AnyOutput.html)`, `[`NextProcess::Renderer`](./enum.NextProcess.html)`))` to render this type next and output to the terminal /// - Returns `Err(`[`ChainProcessError`](./error/enum.ChainProcessError.html)`]` to terminate the program directly pub enum ChainProcess { - Ok((AnyOutput, Next)), + Ok((AnyOutput, NextProcess)), Err(ChainProcessError), } @@ -118,22 +118,22 @@ pub enum ChainProcess { /// - `Chain`: Continue execution to the next chain /// - `Renderer`: Send output to renderer and end execution #[derive(Debug, PartialEq, Eq)] -pub enum Next { +pub enum NextProcess { Chain, Renderer, } -impl std::fmt::Display for Next { +impl std::fmt::Display for NextProcess { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { match self { - Next::Chain => write!(f, "Chain"), - Next::Renderer => write!(f, "Renderer"), + NextProcess::Chain => write!(f, "Chain"), + NextProcess::Renderer => write!(f, "Renderer"), } } } impl From> for ChainProcess { fn from(value: AnyOutput) -> Self { - ChainProcess::Ok((value, Next::Chain)) + ChainProcess::Ok((value, NextProcess::Chain)) } } diff --git a/mingling_core/src/program/exec.rs b/mingling_core/src/program/exec.rs index 7f7aee4..969b64e 100644 --- a/mingling_core/src/program/exec.rs +++ b/mingling_core/src/program/exec.rs @@ -1,7 +1,7 @@ #![allow(clippy::borrowed_box)] use crate::{ - AnyOutput, ChainProcess, Dispatcher, Next, Program, ProgramCollect, RenderResult, + AnyOutput, ChainProcess, Dispatcher, NextProcess, Program, ProgramCollect, RenderResult, error::ProgramInternalExecuteError, }; @@ -50,7 +50,7 @@ where program.run_hook_pre_chain(¤t.member_id, current.inner.as_ref()); match C::do_chain(current).await { - ChainProcess::Ok((any, Next::Renderer)) => { + ChainProcess::Ok((any, NextProcess::Renderer)) => { let mut render_result = render::(program, any); // Run hook @@ -58,7 +58,7 @@ where return Ok(render_result); } - ChainProcess::Ok((any, Next::Chain)) => { + ChainProcess::Ok((any, NextProcess::Chain)) => { // Run hook program.run_hook_post_chain(&any); any @@ -142,7 +142,7 @@ where program.run_hook_pre_chain(¤t.member_id, current.inner.as_ref()); match C::do_chain(current) { - ChainProcess::Ok((any, Next::Renderer)) => { + ChainProcess::Ok((any, NextProcess::Renderer)) => { { let mut render_result = render::(program, any); @@ -152,7 +152,7 @@ where return Ok(render_result); }; } - ChainProcess::Ok((any, Next::Chain)) => { + ChainProcess::Ok((any, NextProcess::Chain)) => { // Run hook program.run_hook_post_chain(&any); any diff --git a/mingling_core/src/tester/chain_process_tester.rs b/mingling_core/src/tester/chain_process_tester.rs index 8cba772..20277fb 100644 --- a/mingling_core/src/tester/chain_process_tester.rs +++ b/mingling_core/src/tester/chain_process_tester.rs @@ -1,6 +1,6 @@ use std::fmt::Display; -use crate::{ChainProcess, Next, ProgramCollect}; +use crate::{ChainProcess, NextProcess, ProgramCollect}; /// Asserts that the chain process result has the expected output type and next state. /// @@ -26,7 +26,7 @@ use crate::{ChainProcess, Next, ProgramCollect}; /// - The result is `ChainProcess::Err`, outputting the error message. /// - When `member_id` is not `None` and does not equal the actual output's `member_id`, displaying the expected and actual values. /// - When `next` is not `None` and does not equal the actual next state, displaying the expected and actual values. -pub fn assert_next_eq(result: &ChainProcess, next: Option, member_id: Option) +pub fn assert_next_eq(result: &ChainProcess, next: Option, member_id: Option) where C: ProgramCollect + Display + PartialEq + 'static, { -- cgit