#[app]Expand description
Generates a main entry point for a RustStream service.
Place it on a synchronous, argument-free function that builds and returns an application -
impl App (the recommended form, hiding the composed type parameters) or a concrete
RustStream<_>. The expansion keeps the function and adds a main that hands it to
ruststream::runtime::cli::run_main, producing a binary that understands the run and
asyncapi gen commands with no hand-written runtime boilerplate.
#[ruststream::app]
fn app() -> impl App {
RustStream::new(AppInfo::new("svc", "0.1.0")).register_broker(MemoryBroker::new())
}The attribute takes the runtime arguments of #[tokio::main]: flavor = "current_thread"
runs the service on a current-thread runtime, worker_threads = n sizes the default
multi-threaded one (flavor = "multi_thread" names the default). A service whose CPU-bound
subscriptions run on dedicated threads (threads(n)) sizes the runtime for its I/O alone.
#[ruststream::app(flavor = "current_thread")]
fn app() -> impl App {
RustStream::new(AppInfo::new("svc", "0.1.0")).register_broker(MemoryBroker::new())
}