1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
//! Resolved subcommand leaf
//!
//! After parsing CLI arguments, the subcommand tree is walked to find the leaf node.
//! [`ResolvedLeaf`] carries typed information about whether the leaf is a stateless CLI command or a
//! stateful TUI application, along with the parsed argument matches and a function pointer to
//! execute it.
//!
//! This type is used by the `main!()` macro expansion to dispatch to the appropriate runner.
//! Application authors do not interact with it directly.
use Future;
use Pin;
use CommandResult;
use Context;
use Projection;
/// Function pointer type for executing a resolved command
///
/// Accepts parsed [`ArgMatches`] and a [`Context`], returning a pinned future that produces a
/// [`CommandResult`].
///
/// [`ArgMatches`]: clap::ArgMatches
/// [`Context`]: clawless_core::context::Context
pub type CommandExec =
fn ;
/// Function pointer type for executing a resolved application
///
/// Accepts parsed [`ArgMatches`], a [`Context`], and a [`Projection`], returning a pinned future
/// that produces a [`CommandResult`].
///
/// [`ArgMatches`]: clap::ArgMatches
/// [`Context`]: clawless_core::context::Context
/// [`Projection`]: clawless_tui::projection::Projection
pub type ApplicationExec = fn ;
/// Resolved subcommand leaf
///
/// The result of walking the subcommand tree after argument parsing. Each variant carries the
/// parsed [`ArgMatches`] for the leaf and a function pointer that executes the leaf with the
/// appropriate arguments.
///
/// `main!()` matches on this enum to choose between [`CommandRunner`] (for commands) and
/// [`ApplicationRunner`] (for applications). This separation allows each leaf type to have its own
/// lifecycle without requiring a uniform function signature in the inventory.
///
/// [`ArgMatches`]: clap::ArgMatches
/// [`ApplicationRunner`]: clawless_tui::runner::ApplicationRunner
/// [`CommandRunner`]: clawless_cli::runner::CommandRunner
// r[impl dispatch.safety.send]
// r[impl dispatch.safety.sync]
// r[impl dispatch.safety.unpin]