From 7bd2dea88c34957122aa640de42f6bba88f5734e Mon Sep 17 00:00:00 2001 From: Weicao-CatilGrass <1992414357@qq.com> Date: Mon, 18 May 2026 12:18:49 +0800 Subject: Add documentation comments to chain and error enums --- mingling_core/src/asset/chain/error.rs | 4 ++++ mingling_core/src/program/exec/error.rs | 26 ++++++++++++++++++++++++++ mingling_core/src/renderer/general/error.rs | 5 +++++ 3 files changed, 35 insertions(+) (limited to 'mingling_core/src') diff --git a/mingling_core/src/asset/chain/error.rs b/mingling_core/src/asset/chain/error.rs index 39e4f62..4269c62 100644 --- a/mingling_core/src/asset/chain/error.rs +++ b/mingling_core/src/asset/chain/error.rs @@ -1,8 +1,12 @@ use crate::error::ProgramInternalExecuteError; +/// Represents errors that can occur during chain processing. #[derive(Debug)] pub enum ChainProcessError { + /// An error with a custom description. Other(String), + + /// An I/O error that occurred during chain processing. IO(std::io::Error), } diff --git a/mingling_core/src/program/exec/error.rs b/mingling_core/src/program/exec/error.rs index 2790a7b..24112e1 100644 --- a/mingling_core/src/program/exec/error.rs +++ b/mingling_core/src/program/exec/error.rs @@ -1,11 +1,23 @@ use crate::error::{ChainProcessError, ProgramPanic}; use std::fmt; +/// Errors that can occur during program execution. +/// +/// This enum represents the various error conditions that may arise +/// when executing a program, including missing dispatchers/renderers, +/// panics, and other miscellaneous errors. #[derive(Debug)] pub enum ProgramExecuteError { + /// No dispatcher was found to handle the program execution. DispatcherNotFound, + + /// No renderer was found for the given name. RendererNotFound(String), + + /// The program encountered a panic during execution. Panic(ProgramPanic), + + /// An other error occurred. Other(String), } @@ -30,11 +42,25 @@ impl From for ProgramExecuteError { } } +/// Errors that can occur during internal program execution. +/// +/// This enum represents error conditions that arise specifically within +/// the internal execution pipeline of a program, including missing +/// dispatchers/renderers, I/O errors, and other miscellaneous failures. +/// These errors are typically not exposed directly to the end user but +/// are used internally and can be converted into [`ProgramExecuteError`]. #[derive(Debug)] pub enum ProgramInternalExecuteError { + /// No dispatcher was found to handle the program execution. DispatcherNotFound, + + /// No renderer was found for the given name. RendererNotFound(String), + + /// An other internal error occurred. Other(String), + + /// An I/O error occurred during execution. IO(std::io::Error), } diff --git a/mingling_core/src/renderer/general/error.rs b/mingling_core/src/renderer/general/error.rs index c462017..a61b19d 100644 --- a/mingling_core/src/renderer/general/error.rs +++ b/mingling_core/src/renderer/general/error.rs @@ -1,5 +1,10 @@ +/// Represents an error that occurs during serialization of a general renderer. +/// +/// This error stores a human-readable message describing what went wrong +/// during the serialization process. #[derive(Debug)] pub struct GeneralRendererSerializeError { + /// The underlying error message. error: String, } -- cgit