aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.md20
-rw-r--r--GETTING-STARTED.md4
-rw-r--r--docs/_zh_CN/pages/10-help.md6
-rw-r--r--docs/_zh_CN/pages/4-render-result.md4
-rw-r--r--docs/_zh_CN/pages/concepts/1-the-pipeline.md4
-rw-r--r--docs/_zh_CN/pages/concepts/4-program-collect.md2
-rw-r--r--docs/pages/10-help.md6
-rw-r--r--docs/pages/4-render-result.md4
-rw-r--r--docs/pages/concepts/1-the-pipeline.md4
-rw-r--r--docs/pages/concepts/4-program-collect.md2
-rw-r--r--examples/example-error-handling/src/main.rs2
-rw-r--r--examples/example-repl-basic/src/main.rs2
-rw-r--r--examples/example-unit-test/src/main.rs2
-rw-r--r--examples/full-todolist/src/help.rs4
-rw-r--r--mingling/src/docs/lib.md2
-rw-r--r--mingling/src/example_docs.rs6
-rw-r--r--mingling/src/gen_program.rs12
-rw-r--r--mingling_core/src/comp.rs2
-rw-r--r--mingling_core/src/program/collection.rs4
-rw-r--r--mingling_core/src/program/collection/mock.rs4
-rw-r--r--mingling_core/src/program/exec.rs4
-rw-r--r--mingling_core/src/program/hook.rs4
-rw-r--r--mingling_macros/src/func/program_fallback_gen.rs2
-rw-r--r--mingling_macros/src/func/program_final_gen.rs6
-rw-r--r--mingling_macros/src/lib.rs12
-rw-r--r--mingling_macros/src/systems/dispatch_tree_gen.rs12
26 files changed, 78 insertions, 58 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index baa7f19..c954123 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -192,6 +192,26 @@ None
_No behavioral changes — this is a pure feature rename. The `extras` feature provides identical functionality to the old `extra_macros` feature; all prelude and macros module re-exports remain the same under the new feature name._
+2. **[`core`]** **[BREAKING RENAME]** Renamed the internal fallback type `ErrorDispatcherNotFound` and its associated `ProgramCollect` plumbing to `EntryFallback` / `build_entry_fallback`.
+
+ **Associated type renames (on `ProgramCollect`):**
+
+ - `type ErrorDispatcherNotFound` → `type EntryFallback`
+ - `fn build_dispatcher_not_found(args)` → `fn build_entry_fallback(args)`
+
+ **Type/enum renames generated by `gen_program!()`:**
+
+ - Enum variant `ThisProgram::ErrorDispatcherNotFound` → `ThisProgram::EntryFallback`
+ - Pack type `ErrorDispatcherNotFound` → `EntryFallback` (created by `program_fallback_gen!()` via `pack!(EntryFallback = Vec<String>)`)
+
+ **Migration guide (for downstream code):**
+
+ - Renderer/help functions that previously took `ErrorDispatcherNotFound` as a parameter must now take `EntryFallback`.
+ - Any code referencing `C::build_dispatcher_not_found(...)` must now call `C::build_entry_fallback(...)`.
+ - Any manual `ProgramCollect` implementation (e.g., in tests or mocks) must rename both the associated type `ErrorDispatcherNotFound` → `EntryFallback` and the associated method `build_dispatcher_not_found` → `build_entry_fallback`.
+
+ _No behavioral changes — this is a pure rename of the internal fallback type and its associated `ProgramCollect` methods. The type's semantics, shape (wrapping `Vec<String>`), and rendering behavior are unchanged.
+
---
### Release 0.3.0 (2026-07-27)
diff --git a/GETTING-STARTED.md b/GETTING-STARTED.md
index 7d451e0..add49eb 100644
--- a/GETTING-STARTED.md
+++ b/GETTING-STARTED.md
@@ -117,7 +117,7 @@ use mingling::prelude::*;
use std::io::Write;
#[renderer]
-fn render_dispatcher_not_found(err: ErrorDispatcherNotFound) -> RenderResult {
+fn render_entry_fallback(err: EntryFallback) -> RenderResult {
let mut result = RenderResult::new();
writeln!(result, "Command not found: [{}]", err.join(" ")).ok();
result
@@ -313,7 +313,7 @@ fn render_too_long(len: ErrorNameTooLong) -> RenderResult {
Two built-in fallback types are always available:
-- `ErrorDispatcherNotFound` — rendered when no dispatcher matches the input
+- `EntryFallback` — rendered when no dispatcher matches the input
- `ErrorRendererNotFound` — rendered when no renderer is found for a result type
---
diff --git a/docs/_zh_CN/pages/10-help.md b/docs/_zh_CN/pages/10-help.md
index 1c4e410..a399ae3 100644
--- a/docs/_zh_CN/pages/10-help.md
+++ b/docs/_zh_CN/pages/10-help.md
@@ -27,14 +27,14 @@ fn help_greet(_entry: EntryGreet) {
## 全局帮助
-你也可以为 `ErrorDispatcherNotFound` 写帮助,作为"根帮助":
+你也可以为 `EntryFallback` 写帮助,作为"根帮助":
```rust
@@@use mingling::macros::help;
@@@use mingling::macros::buffer;
// 用户直接输入 --help 时触发
#[help(buffer)]
-fn help_root(entry: ErrorDispatcherNotFound) {
+fn help_root(entry: EntryFallback) {
r_println!("Usage: my-cli <command>");
r_println!("Commands:");
r_println!(" greet Say hello");
@@ -42,7 +42,7 @@ fn help_root(entry: ErrorDispatcherNotFound) {
```
> [!TIP]
-> `ErrorDispatcherNotFound` 是 `gen_program!()` 自动生成的类型,代表"没有匹配到任何命令"的情况。为它写 `#[help]` 就是给程序的根命令加帮助。
+> `EntryFallback` 是 `gen_program!()` 自动生成的类型,代表"没有匹配到任何命令"的情况。为它写 `#[help]` 就是给程序的根命令加帮助。
## 需要 Setup 配合
diff --git a/docs/_zh_CN/pages/4-render-result.md b/docs/_zh_CN/pages/4-render-result.md
index 8b29fca..7f66c71 100644
--- a/docs/_zh_CN/pages/4-render-result.md
+++ b/docs/_zh_CN/pages/4-render-result.md
@@ -116,13 +116,13 @@ cargo run -- great
## 补上 Fallback
-`gen_program!()` 自动生成了一个 `ErrorDispatcherNotFound` 类型,包裹 `Vec<String>`——它存的是用户输入的那些没匹配到的命令。你只需要给它写一个 Renderer:
+`gen_program!()` 自动生成了一个 `EntryFallback` 类型,包裹 `Vec<String>`——它存的是用户输入的那些没匹配到的命令。你只需要给它写一个 Renderer:
```rust
use mingling::macros::buffer;
#[renderer(buffer)]
-fn render_dispatcher_not_found(err: ErrorDispatcherNotFound) {
+fn render_entry_fallback(err: EntryFallback) {
if err.inner.is_empty() {
r_println!("Unknown command");
} else {
diff --git a/docs/_zh_CN/pages/concepts/1-the-pipeline.md b/docs/_zh_CN/pages/concepts/1-the-pipeline.md
index b0bb19d..9c74087 100644
--- a/docs/_zh_CN/pages/concepts/1-the-pipeline.md
+++ b/docs/_zh_CN/pages/concepts/1-the-pipeline.md
@@ -42,12 +42,12 @@ graph TD
graph LR
Input["用户输入"] --> M{匹配 Dispatcher}
M -->|"匹配到"| E["调用 dispatcher.begin(args)<br/>返回包装好的 Entry"]
- M -->|"未匹配"| NF["build_dispatcher_not_found<br/>生成 ErrorDispatcherNotFound"]
+ M -->|"未匹配"| NF["build_entry_fallback<br/>生成 EntryFallback"]
```
匹配成功后调用 `dispatcher.begin(args)`,返回 `ChainProcess::Ok((AnyOutput, _))`,即包装好用户输入参数的 Entry 类型。
-如果没有匹配到任何 Dispatcher,则生成 `ErrorDispatcherNotFound`(包裹完整的输入参数),后续可以被 Renderer 处理显示 "Command not found"。
+如果没有匹配到任何 Dispatcher,则生成 `EntryFallback`(包裹完整的输入参数),后续可以被 Renderer 处理显示 "Command not found"。
### 2. Help 短路
diff --git a/docs/_zh_CN/pages/concepts/4-program-collect.md b/docs/_zh_CN/pages/concepts/4-program-collect.md
index f5e6b8f..a0236f6 100644
--- a/docs/_zh_CN/pages/concepts/4-program-collect.md
+++ b/docs/_zh_CN/pages/concepts/4-program-collect.md
@@ -21,7 +21,7 @@
- **`render`** —— 根据 `member_id` 调用对应的 `#[renderer]` 函数,写入 `RenderResult`
- **`render_help`** —— 根据 `member_id` 调用对应的 `#[help]` 函数
- **`has_chain` / `has_renderer`** —— 判断某个变体有没有对应的处理函数
-- **`build_dispatcher_not_found` / `build_renderer_not_found` / `build_empty_result`** —— 三个内置降级类型,处理边界情况
+- **`build_entry_fallback` / `build_renderer_not_found` / `build_empty_result`** —— 三个内置降级类型,处理边界情况
这套映射在运行时通过枚举匹配来完成——编译期只生成了枚举和匹配分支,实际的函数调用发生在运行时。
diff --git a/docs/pages/10-help.md b/docs/pages/10-help.md
index 1e3ea78..d9cc557 100644
--- a/docs/pages/10-help.md
+++ b/docs/pages/10-help.md
@@ -27,14 +27,14 @@ fn help_greet(_entry: EntryGreet) {
## Global Help
-You can also write help for `ErrorDispatcherNotFound` as the "root help":
+You can also write help for `EntryFallback` as the "root help":
```rust
@@@use mingling::macros::help;
@@@use mingling::macros::buffer;
// Triggered when user passes --help directly
#[help(buffer)]
-fn help_root(entry: ErrorDispatcherNotFound) {
+fn help_root(entry: EntryFallback) {
r_println!("Usage: my-cli <command>");
r_println!("Commands:");
r_println!(" greet Say hello");
@@ -42,7 +42,7 @@ fn help_root(entry: ErrorDispatcherNotFound) {
```
> [!TIP]
-> `ErrorDispatcherNotFound` is a type generated by `gen_program!()`, representing "no matching command found." Writing `#[help]` for it adds help to the program's root command.
+> `EntryFallback` is a type generated by `gen_program!()`, representing "no matching command found." Writing `#[help]` for it adds help to the program's root command.
## Requires Setup
diff --git a/docs/pages/4-render-result.md b/docs/pages/4-render-result.md
index 9e72d09..7b63b45 100644
--- a/docs/pages/4-render-result.md
+++ b/docs/pages/4-render-result.md
@@ -116,13 +116,13 @@ cargo run -- great
## Adding a Fallback
-`gen_program!()` auto-generates an `ErrorDispatcherNotFound` type wrapping `Vec<String>`—it holds the user input that didn't match any command. You just need to write a Renderer for it:
+`gen_program!()` auto-generates an `EntryFallback` type wrapping `Vec<String>`—it holds the user input that didn't match any command. You just need to write a Renderer for it:
```rust
use mingling::macros::buffer;
#[renderer(buffer)]
-fn render_dispatcher_not_found(err: ErrorDispatcherNotFound) {
+fn render_entry_fallback(err: EntryFallback) {
if err.inner.is_empty() {
r_println!("Unknown command");
} else {
diff --git a/docs/pages/concepts/1-the-pipeline.md b/docs/pages/concepts/1-the-pipeline.md
index e73379d..2ee26d0 100644
--- a/docs/pages/concepts/1-the-pipeline.md
+++ b/docs/pages/concepts/1-the-pipeline.md
@@ -42,12 +42,12 @@ The matching rule is **prefix matching** on space-separated tokens — the longe
graph LR
Input["user input"] --> M{"match Dispatcher"}
M -->|"matched"| E["call dispatcher.begin(args)<br/>return wrapped Entry"]
- M -->|"no match"| NF["build_dispatcher_not_found<br/>generate ErrorDispatcherNotFound"]
+ M -->|"no match"| NF["build_entry_fallback<br/>generate EntryFallback"]
```
On a match, `dispatcher.begin(args)` is called, returning `ChainProcess::Ok((AnyOutput, _))` — the Entry type wrapping the user's input params.
-If no Dispatcher matches, `ErrorDispatcherNotFound` is generated (wrapping the full input), which a Renderer can later handle to display "Command not found".
+If no Dispatcher matches, `EntryFallback` is generated (wrapping the full input), which a Renderer can later handle to display "Command not found".
### 2. Help Shortcut
diff --git a/docs/pages/concepts/4-program-collect.md b/docs/pages/concepts/4-program-collect.md
index a24f115..c5203c3 100644
--- a/docs/pages/concepts/4-program-collect.md
+++ b/docs/pages/concepts/4-program-collect.md
@@ -21,7 +21,7 @@ This enum is the type of `G` in `AnyOutput<G>` — the scheduler uses enum varia
- **`render`** — calls the corresponding `#[renderer]` function by `member_id`, writes to `RenderResult`
- **`render_help`** — calls the corresponding `#[help]` function by `member_id`
- **`has_chain` / `has_renderer`** — checks whether a variant has a corresponding handler
-- **`build_dispatcher_not_found` / `build_renderer_not_found` / `build_empty_result`** — three built-in fallback types for edge cases
+- **`build_entry_fallback` / `build_renderer_not_found` / `build_empty_result`** — three built-in fallback types for edge cases
This mapping is resolved at runtime via enum matching — only the enum and match branches are generated at compile time; actual function calls happen at runtime.
diff --git a/examples/example-error-handling/src/main.rs b/examples/example-error-handling/src/main.rs
index de9792d..0cd973a 100644
--- a/examples/example-error-handling/src/main.rs
+++ b/examples/example-error-handling/src/main.rs
@@ -94,7 +94,7 @@ fn render_error_name_too_long(len: ErrorNameTooLong) -> RenderResult {
/// Renders the error when the dispatcher (subcommand) is not found.
#[renderer]
-fn render_dispatcher_not_found(err: ErrorDispatcherNotFound) -> RenderResult {
+fn render_entry_fallback(err: EntryFallback) -> RenderResult {
let mut render_result = RenderResult::new();
writeln!(
render_result,
diff --git a/examples/example-repl-basic/src/main.rs b/examples/example-repl-basic/src/main.rs
index cfd00d1..361488d 100644
--- a/examples/example-repl-basic/src/main.rs
+++ b/examples/example-repl-basic/src/main.rs
@@ -178,7 +178,7 @@ fn render_error_directory_not_exist(err: ErrorDirectoryNotExist) -> RenderResult
/// Handle dispatcher not found event
/// Renders the error when a command is not found.
#[renderer]
-fn dispatcher_not_found(prev: ErrorDispatcherNotFound) -> RenderResult {
+fn dispatcher_not_found(prev: EntryFallback) -> RenderResult {
let mut render_result = RenderResult::new();
writeln!(render_result, "Command not found: \"{}\"", prev.join(", ")).ok();
render_result
diff --git a/examples/example-unit-test/src/main.rs b/examples/example-unit-test/src/main.rs
index e9169df..33ddde0 100644
--- a/examples/example-unit-test/src/main.rs
+++ b/examples/example-unit-test/src/main.rs
@@ -126,7 +126,7 @@ fn render_error_name_too_long(len: ErrorNameTooLong) -> RenderResult {
/// Renders the error when the dispatcher (subcommand) is not found.
#[renderer]
-fn render_dispatcher_not_found(err: ErrorDispatcherNotFound) -> RenderResult {
+fn render_entry_fallback(err: EntryFallback) -> RenderResult {
let mut render_result = RenderResult::new();
writeln!(
render_result,
diff --git a/examples/full-todolist/src/help.rs b/examples/full-todolist/src/help.rs
index 2f8228a..48b93f2 100644
--- a/examples/full-todolist/src/help.rs
+++ b/examples/full-todolist/src/help.rs
@@ -1,12 +1,12 @@
//! This module provides help information for the `todolist` command line program
-use crate::{EntryAdd, EntryClean, EntryComplete, EntryList, ErrorDispatcherNotFound};
+use crate::{EntryAdd, EntryClean, EntryComplete, EntryList, EntryFallback};
use mingling::{RenderResult, macros::help};
use std::io::Write;
/// Shows the global help message.
#[help]
-pub fn help_global(_p: ErrorDispatcherNotFound) -> RenderResult {
+pub fn help_global(_p: EntryFallback) -> RenderResult {
let mut render_result = RenderResult::new();
writeln!(
render_result,
diff --git a/mingling/src/docs/lib.md b/mingling/src/docs/lib.md
index a7a583b..697f6c5 100644
--- a/mingling/src/docs/lib.md
+++ b/mingling/src/docs/lib.md
@@ -51,7 +51,7 @@ fn render_name(name: ResultName) -> RenderResult {
}
#[renderer]
-fn render_dispatcher_not_found(err: ErrorDispatcherNotFound) -> RenderResult {
+fn render_entry_fallback(err: EntryFallback) -> RenderResult {
let mut result = RenderResult::default();
if err.len() > 0 {
result.println(&format!("Command not found: [{}]", err.join(" ")));
diff --git a/mingling/src/example_docs.rs b/mingling/src/example_docs.rs
index 6f37a13..cb6bbe7 100644
--- a/mingling/src/example_docs.rs
+++ b/mingling/src/example_docs.rs
@@ -1500,7 +1500,7 @@ pub mod example_enum_tag {}
///
/// /// Renders the error when the dispatcher (subcommand) is not found.
/// #[renderer]
-/// fn render_dispatcher_not_found(err: ErrorDispatcherNotFound) -> RenderResult {
+/// fn render_entry_fallback(err: EntryFallback) -> RenderResult {
/// let mut render_result = RenderResult::new();
/// writeln!(
/// render_result,
@@ -2580,7 +2580,7 @@ pub mod example_pathfinder {}
/// /// Handle dispatcher not found event
/// /// Renders the error when a command is not found.
/// #[renderer]
-/// fn dispatcher_not_found(prev: ErrorDispatcherNotFound) -> RenderResult {
+/// fn dispatcher_not_found(prev: EntryFallback) -> RenderResult {
/// let mut render_result = RenderResult::new();
/// writeln!(render_result, "Command not found: \"{}\"", prev.join(", ")).ok();
/// render_result
@@ -2970,7 +2970,7 @@ pub mod example_structural_renderer {}
///
/// /// Renders the error when the dispatcher (subcommand) is not found.
/// #[renderer]
-/// fn render_dispatcher_not_found(err: ErrorDispatcherNotFound) -> RenderResult {
+/// fn render_entry_fallback(err: EntryFallback) -> RenderResult {
/// let mut render_result = RenderResult::new();
/// writeln!(
/// render_result,
diff --git a/mingling/src/gen_program.rs b/mingling/src/gen_program.rs
index aa0c4b5..a3b7e29 100644
--- a/mingling/src/gen_program.rs
+++ b/mingling/src/gen_program.rs
@@ -28,7 +28,7 @@ pub enum ThisProgram {
/// Indicates that no matching renderer was found for the given output.
ErrorRendererNotFound,
/// Indicates that no matching dispatcher was found for the given arguments.
- ErrorDispatcherNotFound,
+ EntryFallback,
/// Indicates that the result is empty.
ResultEmpty,
/// Indicates the completion suggestions computed by the program for rendering.
@@ -52,7 +52,7 @@ pub struct ErrorRendererNotFound {
///
/// This type is created by the `pack!` macro as a variant of the
/// program's output type set (`ThisProgram`).
-pub struct ErrorDispatcherNotFound {
+pub struct EntryFallback {
/// The arguments provided by the user
pub(crate) inner: Vec<String>,
}
@@ -139,9 +139,9 @@ unsafe impl Grouped<ThisProgram> for ErrorRendererNotFound {
// However, these are marked `unsafe` because the `Grouped` trait requires the
// implementor to guarantee that the type is the only one associated with the
// given enum variant — a guarantee that should be carefully verified in production code.
-unsafe impl Grouped<ThisProgram> for ErrorDispatcherNotFound {
+unsafe impl Grouped<ThisProgram> for EntryFallback {
fn member_id() -> ThisProgram {
- ThisProgram::ErrorDispatcherNotFound
+ ThisProgram::EntryFallback
}
}
@@ -186,7 +186,7 @@ unsafe impl Grouped<ThisProgram> for CompletionSuggest {
impl ProgramCollect for ThisProgram {
type Enum = ThisProgram;
- type ErrorDispatcherNotFound = ErrorDispatcherNotFound;
+ type EntryFallback = EntryFallback;
type ErrorRendererNotFound = ErrorRendererNotFound;
@@ -196,7 +196,7 @@ impl ProgramCollect for ThisProgram {
todo!()
}
- fn build_dispatcher_not_found(_args: Vec<String>) -> mingling_core::AnyOutput<Self::Enum> {
+ fn build_entry_fallback(_args: Vec<String>) -> mingling_core::AnyOutput<Self::Enum> {
todo!()
}
diff --git a/mingling_core/src/comp.rs b/mingling_core/src/comp.rs
index d8dcfbd..952fb87 100644
--- a/mingling_core/src/comp.rs
+++ b/mingling_core/src/comp.rs
@@ -139,7 +139,7 @@ impl CompletionHelper {
trace!("entry type: {}", any.member_id);
let dispatcher_not_found =
- <P::ErrorDispatcherNotFound as crate::Grouped<P>>::member_id();
+ <P::EntryFallback as crate::Grouped<P>>::member_id();
if dispatcher_not_found == any.member_id {
debug!("dispatcher_not_found matched");
diff --git a/mingling_core/src/program/collection.rs b/mingling_core/src/program/collection.rs
index fa062cf..1b4d7dd 100644
--- a/mingling_core/src/program/collection.rs
+++ b/mingling_core/src/program/collection.rs
@@ -22,7 +22,7 @@ pub trait ProgramCollect {
/// Enum type representing internal IDs for the program
type Enum;
/// Error type when a dispatcher is not found for the given member
- type ErrorDispatcherNotFound: Grouped<Self::Enum>;
+ type EntryFallback: Grouped<Self::Enum>;
/// Error type when a renderer is not found for the given member
type ErrorRendererNotFound: Grouped<Self::Enum>;
@@ -55,7 +55,7 @@ pub trait ProgramCollect {
fn build_renderer_not_found(member_id: Self::Enum) -> AnyOutput<Self::Enum>;
/// Build an [`AnyOutput`](./struct.AnyOutput.html) to indicate that a dispatcher was not found
- fn build_dispatcher_not_found(args: Vec<String>) -> AnyOutput<Self::Enum>;
+ fn build_entry_fallback(args: Vec<String>) -> AnyOutput<Self::Enum>;
/// Build an [`AnyOutput`](./struct.AnyOutput.html) to indicate that the chain returned an empty result
fn build_empty_result() -> AnyOutput<Self::Enum>;
diff --git a/mingling_core/src/program/collection/mock.rs b/mingling_core/src/program/collection/mock.rs
index dbe4789..cd2abf5 100644
--- a/mingling_core/src/program/collection/mock.rs
+++ b/mingling_core/src/program/collection/mock.rs
@@ -34,7 +34,7 @@ unsafe impl Grouped<MockProgramCollect> for MockProgramCollect {
impl ProgramCollect for MockProgramCollect {
type Enum = MockProgramCollect;
- type ErrorDispatcherNotFound = MockProgramCollect;
+ type EntryFallback = MockProgramCollect;
type ErrorRendererNotFound = MockProgramCollect;
type ResultEmpty = MockProgramCollect;
@@ -54,7 +54,7 @@ impl ProgramCollect for MockProgramCollect {
unreachable!()
}
- fn build_dispatcher_not_found(_args: Vec<String>) -> AnyOutput<Self::Enum> {
+ fn build_entry_fallback(_args: Vec<String>) -> AnyOutput<Self::Enum> {
unreachable!()
}
diff --git a/mingling_core/src/program/exec.rs b/mingling_core/src/program/exec.rs
index f0322a5..d9b4dd8 100644
--- a/mingling_core/src/program/exec.rs
+++ b/mingling_core/src/program/exec.rs
@@ -45,7 +45,7 @@ where
}
// Current
- let mut current = C::build_dispatcher_not_found(vec![]);
+ let mut current = C::build_entry_fallback(vec![]);
// Run hooks
control!(
@@ -193,7 +193,7 @@ where
}
Err(ProgramInternalExecuteError::DispatcherNotFound) => {
// No matching Dispatcher is found
- C::build_dispatcher_not_found(args.to_vec())
+ C::build_entry_fallback(args.to_vec())
}
Err(e) => return Err(e),
};
diff --git a/mingling_core/src/program/hook.rs b/mingling_core/src/program/hook.rs
index 7d94a21..50c53d7 100644
--- a/mingling_core/src/program/hook.rs
+++ b/mingling_core/src/program/hook.rs
@@ -713,7 +713,7 @@ mod tests {
impl ProgramCollect for MockHookEnum {
type Enum = MockHookEnum;
- type ErrorDispatcherNotFound = MockHookEnum;
+ type EntryFallback = MockHookEnum;
type ErrorRendererNotFound = MockHookEnum;
type ResultEmpty = MockHookEnum;
@@ -721,7 +721,7 @@ mod tests {
unreachable!()
}
- fn build_dispatcher_not_found(_args: Vec<String>) -> crate::AnyOutput<MockHookEnum> {
+ fn build_entry_fallback(_args: Vec<String>) -> crate::AnyOutput<MockHookEnum> {
unreachable!()
}
diff --git a/mingling_macros/src/func/program_fallback_gen.rs b/mingling_macros/src/func/program_fallback_gen.rs
index 3d095e5..93d8616 100644
--- a/mingling_macros/src/func/program_fallback_gen.rs
+++ b/mingling_macros/src/func/program_fallback_gen.rs
@@ -16,7 +16,7 @@ pub(crate) fn program_fallback_gen_impl(_input: TokenStream) -> TokenStream {
let expanded = quote! {
::mingling::macros::pack!(ErrorRendererNotFound = String);
- ::mingling::macros::pack!(ErrorDispatcherNotFound = Vec<String>);
+ ::mingling::macros::pack!(EntryFallback = Vec<String>);
#pack_empty
};
TokenStream::from(expanded)
diff --git a/mingling_macros/src/func/program_final_gen.rs b/mingling_macros/src/func/program_final_gen.rs
index 0eed1db..e8545f4 100644
--- a/mingling_macros/src/func/program_final_gen.rs
+++ b/mingling_macros/src/func/program_final_gen.rs
@@ -298,15 +298,15 @@ pub(crate) fn program_final_gen_impl(_input: TokenStream) -> TokenStream {
impl ::mingling::ProgramCollect for #name {
type Enum = #name;
- type ErrorDispatcherNotFound = ErrorDispatcherNotFound;
+ type EntryFallback = EntryFallback;
type ErrorRendererNotFound = ErrorRendererNotFound;
type ResultEmpty = ResultEmpty;
fn build_renderer_not_found(member_id: Self::Enum) -> ::mingling::AnyOutput<Self::Enum> {
::mingling::AnyOutput::new(ErrorRendererNotFound::new(member_id.to_string()))
}
- fn build_dispatcher_not_found(args: Vec<String>) -> ::mingling::AnyOutput<Self::Enum> {
- ::mingling::AnyOutput::new(ErrorDispatcherNotFound::new(args))
+ fn build_entry_fallback(args: Vec<String>) -> ::mingling::AnyOutput<Self::Enum> {
+ ::mingling::AnyOutput::new(EntryFallback::new(args))
}
fn build_empty_result() -> ::mingling::AnyOutput<Self::Enum> {
::mingling::AnyOutput::new(ResultEmpty)
diff --git a/mingling_macros/src/lib.rs b/mingling_macros/src/lib.rs
index b6656da..c955e36 100644
--- a/mingling_macros/src/lib.rs
+++ b/mingling_macros/src/lib.rs
@@ -36,7 +36,7 @@
//! │ V │
//! │ Reads all registries → generates ThisProgram with: │
//! │ • ProgramCollect impl (dispatch/render/chain dispatch tree) │
-//! │ • Fallback types (ErrorDispatcherNotFound, etc.) │
+//! │ • Fallback types (EntryFallback, etc.) │
//! │ • Completion logic (if `comp` feature enabled) │
//! └──────────────────────────────────────────────────────────────────┘
//! ```
@@ -120,8 +120,8 @@
//! ```rust,ignore
//! // Example of what gen_program! generates (simplified):
//! impl ProgramCollect for ThisProgram {
-//! fn build_dispatcher_not_found(args: Vec<String>) -> AnyOutput {
-//! AnyOutput::new(ErrorDispatcherNotFound::new(args))
+//! fn build_entry_fallback(args: Vec<String>) -> AnyOutput {
+//! AnyOutput::new(EntryFallback::new(args))
//! }
//! fn has_chain(any: &AnyOutput) -> bool {
//! match any.member_id() {
@@ -978,11 +978,11 @@ pub fn chain(attr: TokenStream, item: TokenStream) -> TokenStream {
/// The macros `gen_program!` automatically generates two fallback types that
/// you can provide renderers for:
/// - `ErrorRendererNotFound` — triggered when no matching renderer is found
-/// - `ErrorDispatcherNotFound` — triggered when no matching dispatcher is found
+/// - `EntryFallback` — triggered when no matching dispatcher is found
///
/// ```rust,ignore
/// #[renderer]
-/// fn fallback_dispatcher_not_found(prev: ErrorDispatcherNotFound) -> RenderResult {
+/// fn fallback_dispatcher_not_found(prev: EntryFallback) -> RenderResult {
/// let mut result = RenderResult::new();
/// writeln!(result, "Unknown command: {}", prev.join(", "));
/// result
@@ -1819,7 +1819,7 @@ pub fn derive_grouped_serialize(input: TokenStream) -> TokenStream {
/// 1. **`pub type Next = ChainProcess<ProgramName>`** — A convenience type alias
/// for use in chain function return types.
/// 2. **`program_comp_gen!(...)`** (with `comp` feature) — Generates completion infrastructure.
-/// 3. **`program_fallback_gen!(...)`** — Generates `ErrorRendererNotFound` and `ErrorDispatcherNotFound` types.
+/// 3. **`program_fallback_gen!(...)`** — Generates `ErrorRendererNotFound` and `EntryFallback` types.
/// 4. **`program_final_gen!(...)`** — Generates the program enum with:
/// - An enum with all packed types as variants
/// - `Display` implementation for the enum
diff --git a/mingling_macros/src/systems/dispatch_tree_gen.rs b/mingling_macros/src/systems/dispatch_tree_gen.rs
index fe44a49..8e3660c 100644
--- a/mingling_macros/src/systems/dispatch_tree_gen.rs
+++ b/mingling_macros/src/systems/dispatch_tree_gen.rs
@@ -61,7 +61,7 @@ pub(crate) fn gen_dispatch_args_trie(entries: &[(String, String, String)]) -> To
fn build_dispatch_body(nodes: &[(String, String)], depth: usize) -> TokenStream {
if nodes.is_empty() {
return quote! {
- return Ok(Self::build_dispatcher_not_found(raw.to_vec()));
+ return Ok(Self::build_entry_fallback(raw.to_vec()));
};
}
@@ -113,7 +113,7 @@ fn build_dispatch_body(nodes: &[(String, String)], depth: usize) -> TokenStream
arms.push(quote! {
Some(#ch_char) => {
#arm
- return Ok(Self::build_dispatcher_not_found(raw.to_vec()));
+ return Ok(Self::build_entry_fallback(raw.to_vec()));
}
});
} else {
@@ -135,7 +135,7 @@ fn build_dispatch_body(nodes: &[(String, String)], depth: usize) -> TokenStream
let match_body = quote! {
match raw_chars.nth(0) {
#(#arms)*
- _ => return Ok(Self::build_dispatcher_not_found(raw.to_vec())),
+ _ => return Ok(Self::build_entry_fallback(raw.to_vec())),
}
};
quote! {
@@ -145,17 +145,17 @@ fn build_dispatch_body(nodes: &[(String, String)], depth: usize) -> TokenStream
} else if !exact_checks.is_empty() {
quote! {
#(#exact_checks)*
- return Ok(Self::build_dispatcher_not_found(raw.to_vec()));
+ return Ok(Self::build_entry_fallback(raw.to_vec()));
}
} else if arms.is_empty() {
quote! {
- return Ok(Self::build_dispatcher_not_found(raw.to_vec()));
+ return Ok(Self::build_entry_fallback(raw.to_vec()));
}
} else {
quote! {
match raw_chars.nth(0) {
#(#arms)*
- _ => return Ok(Self::build_dispatcher_not_found(raw.to_vec())),
+ _ => return Ok(Self::build_entry_fallback(raw.to_vec())),
}
}
}