From 85ee549f68449bc70a7f1271a93ad26a8207ee40 Mon Sep 17 00:00:00 2001 From: 魏曹先生 <1992414357@qq.com> Date: Tue, 28 Apr 2026 22:39:59 +0800 Subject: Rebuild and rewrite the documentation site infrastructure --- docs/pages/2-basic/4-chain.md | 75 ------------------------------------------- 1 file changed, 75 deletions(-) delete mode 100644 docs/pages/2-basic/4-chain.md (limited to 'docs/pages/2-basic/4-chain.md') diff --git a/docs/pages/2-basic/4-chain.md b/docs/pages/2-basic/4-chain.md deleted file mode 100644 index d47642a..0000000 --- a/docs/pages/2-basic/4-chain.md +++ /dev/null @@ -1,75 +0,0 @@ -
- Mingling's Basic Components -
- ---- - -## Intro - -Like `Dispatcher`, `Chain` is also a core concept in building the entire **Mingling** framework. It is used to receive a dispatch of one type and convert it into another type. - -```rust -dispatcher!("hello", - HelloCommand => HelloEntry); - -// Define intermediate type ParsedHello, internally a String -pack!(ParsedHello = String); - -// Define chain parse_hello (expands to ParseHello) -// Declare conversion from HelloEntry -#[chain] -fn parse_hello(prev: HelloEntry) -> NextProcess { - // Take the inner reference of HelloEntry - let args = &*prev; - - // Extract the first argument, use default value "World" - // if it doesn't exist - let first = args.first().cloned().unwrap_or_else(|| "World".to_string()); - - // Pack the extracted argument into ParsedHello and - // dispatch to the next chain - ParsedHello::new(first).to_chain() -} -``` - -> [!Tip] -> `NextProcess` is a marker type in **Mingling**, from `mingling::marker`. -> -> It serves no functional purpose other than to simplify the declaration of chain functions. After the `chain!` macro expands, `NextProcess` will be replaced with `mingling::ChainProcess