Skip to main content

cli_main

Function cli_main 

Source
pub fn cli_main(embedder: &'static Embedder) -> i32
Expand description

Library entry point. An embedder calls this with its own &'static Embedder (and optional setting defaults); the aube binary passes &aube_util::AUBE and no defaults, reproducing standalone behavior. This is the whole embedding API: register-then-run in one call, so a host never has to separately wire identity and defaults.

Returns the exit code; it does not terminate the process. It parses argv, runs the selected command, renders any diagnostic to stderr, and hands back the code the binary’s main should exit with. Returning rather than calling std::process::exit keeps it embed-safe: a host that drives it in-process is not hard-killed by a non-zero result or an error. The standalone binary does std::process::exit(cli_main(..)).

#[must_use]: the i32 is the exit code, not a side effect. An embedder migrating off the old process::exit entrypoint that drops it would silently exit 0 on every failure — Rust won’t warn on an ignored return — so the lint nudges them to std::process::exit(cli_main(..)).