diff options
| author | Weicao-CatilGrass <1992414357@qq.com> | 2026-05-17 22:30:50 +0800 |
|---|---|---|
| committer | Weicao-CatilGrass <1992414357@qq.com> | 2026-05-17 22:38:39 +0800 |
| commit | f27f5aeb09616b932ab48f0905994879dd8bafe5 (patch) | |
| tree | 2deea67f7ed910ad824fbcce2330ab5c475e51a0 /mingling_core | |
| parent | bdd736ad9899aed74aaa2760c6e068dcae0e6925 (diff) | |
Rename `NextProcess` to `Next` across the codebase
Diffstat (limited to 'mingling_core')
| -rw-r--r-- | mingling_core/src/any.rs | 20 | ||||
| -rw-r--r-- | mingling_core/src/program/exec.rs | 10 | ||||
| -rw-r--r-- | mingling_core/src/tester/chain_process_tester.rs | 4 |
3 files changed, 17 insertions, 17 deletions
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<G> AnyOutput<G> { /// Route the output to the next Chain pub fn route_chain(self) -> ChainProcess<G> { - ChainProcess::Ok((self, Next::Chain)) + ChainProcess::Ok((self, NextProcess::Chain)) } /// Route the output to the Renderer, ending execution pub fn route_renderer(self) -> ChainProcess<G> { - ChainProcess::Ok((self, Next::Renderer)) + ChainProcess::Ok((self, NextProcess::Renderer)) } #[cfg(feature = "general_renderer")] @@ -105,11 +105,11 @@ impl<G> std::ops::DerefMut for AnyOutput<G> { /// 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<G> { - Ok((AnyOutput<G>, Next)), + Ok((AnyOutput<G>, NextProcess)), Err(ChainProcessError), } @@ -118,22 +118,22 @@ pub enum ChainProcess<G> { /// - `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<G> From<AnyOutput<G>> for ChainProcess<G> { fn from(value: AnyOutput<G>) -> 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::<C>(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::<C>(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<C>(result: &ChainProcess<C>, next: Option<Next>, member_id: Option<C>) +pub fn assert_next_eq<C>(result: &ChainProcess<C>, next: Option<NextProcess>, member_id: Option<C>) where C: ProgramCollect + Display + PartialEq + 'static, { |
