aboutsummaryrefslogtreecommitdiff
path: root/mingling/src
diff options
context:
space:
mode:
Diffstat (limited to 'mingling/src')
-rw-r--r--mingling/src/docs/gen_program.md2
-rw-r--r--mingling/src/docs/lib.md2
-rw-r--r--mingling/src/example_docs.rs6
-rw-r--r--mingling/src/gen_program.rs14
4 files changed, 14 insertions, 10 deletions
diff --git a/mingling/src/docs/gen_program.md b/mingling/src/docs/gen_program.md
index 91e7b91..16402c0 100644
--- a/mingling/src/docs/gen_program.md
+++ b/mingling/src/docs/gen_program.md
@@ -7,10 +7,12 @@ You can access them like this:
```rust
# pub struct ThisProgram;
# impl ThisProgram { fn new() -> Self { ThisProgram } }
+# fn main() {
// main.rs / lib.rs
// Use them here via crate::*
let mut program = crate::ThisProgram::new();
+# }
// `ThisProgram` is generated here
// |
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 18d9117..a3b7e29 100644
--- a/mingling/src/gen_program.rs
+++ b/mingling/src/gen_program.rs
@@ -23,10 +23,12 @@ pub struct Entry {
///
/// It contains the IDs of all types for this program, registered by the `register_type!` macro.
pub enum ThisProgram {
+ /// The generic program entry point.
+ Entry,
/// 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.
@@ -50,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>,
}
@@ -137,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
}
}
@@ -184,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;
@@ -194,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!()
}