Skip to main content

RunMainExt

Trait RunMainExt 

Source
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§

Source

fn run_main(&mut self) -> impl Future<Output = ExitCode> + Send

Runs the main CLI application.

This method:

  1. Registers default commands (server, config) if not already present
  2. Builds the CLI interface from registered commands
  3. Parses command-line arguments
  4. Loads and merges configuration files
  5. Sets up tracing/logging
  6. Builds the application
  7. 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".

Implementations on Foreign Types§

Source§

impl RunMainExt for AppBuilder

Source§

async fn run_main(&mut self) -> ExitCode

Implementors§