pub trait RunMainExt {
// Required method
fn run_main(&mut self) -> impl Future<Output = ExitCode> + Send;
}Expand description
Extension trait for AppBuilder to run the main CLI application.
This trait provides the main entry point for CLI applications, handling argument parsing, configuration loading, and command execution.
Required Methods§
Sourcefn run_main(&mut self) -> impl Future<Output = ExitCode> + Send
fn run_main(&mut self) -> impl Future<Output = ExitCode> + Send
Runs the main CLI application.
This method:
- Registers default commands (server, config) if not already present
- Builds the CLI interface from registered commands
- Parses command-line arguments
- Loads and merges configuration files
- Sets up tracing/logging
- Builds the application
- Executes the selected command
§Returns
Returns the exit code from the executed command.
§Examples
use diode::App;
use diode_base::RunMainExt;
#[tokio::main]
async fn main() -> std::process::ExitCode {
App::builder().run_main().await
}Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".