pub struct AutoStart;Expand description
The one-line application entry point (Java AutoStart.main(args)): loads
the -D runtime overrides, installs the logger, collects every
annotated item from the link-time inventory (#[preload],
#[before_application], #[main_application] — the classpath-scanning
analog), and runs the lifecycle. A standalone fn main() uses
AutoStart::run, which then keeps serving until Ctrl-C; an embedder
(tests, an existing async context) calls AutoStart::main, which returns
once the app is booted (the HTTP/websocket accept loop runs in the
background).
Implementations§
Source§impl AutoStart
impl AutoStart
Sourcepub fn run() -> Result<(), AppError>
pub fn run() -> Result<(), AppError>
Build a Tokio runtime, boot the application, then — when serving (REST
automation on, or any websocket service registered) — stay alive until
Ctrl-C (Java: the JVM stays up on non-daemon threads). This is the whole
fn main() body; the auto_start_main! macro wraps exactly this plus
the app’s resource root.
Sourcepub async fn main(args: Vec<String>) -> Result<(), AppError>
pub async fn main(args: Vec<String>) -> Result<(), AppError>
The async lifecycle (must run within a Tokio runtime): run every
before-application hook, bind the preloads, start the HTTP/websocket
server when serving — then return (the accept loop keeps running as
a background task). Booting the engine hands control back to the caller;
a standalone process uses AutoStart::run to serve until Ctrl-C.
Runs only once per process (Java parity: AutoStart.started is an
AtomicBoolean) — repeated execution is a no-op.