Expand description
App builder and Plugin trait. Wraps [bevy_ecs::World] and Schedule directly without depending on bevy_app.
§Two-world architecture
App holds a main world for app/UI state and a render world for per-frame extracted draw data and GPU resources.
Cross-world flow is documented in crate::render_world.
§Tick
Each call to App::tick runs:
Tickadvance(), bumping the frame counter anddt.- The main schedule, ordered
Input -> CommandDrain -> Systems -> LayoutSync -> A11ySync.
Steps 3 to 5 run only when FrameDirty is set; an idle tick stops after step 2.
clear_extractedon the render world to remove transientExtracted*entities.- Every registered
ExtractFnagainst(&mut main, &mut render). The main world is taken mutably becausebevy_ecs::world::World::querymutates the world’s query cache; extract does not change main-world state. - The render schedule on the render world, ordered
Prepare -> Render.
Structs§
- App
- Lumen application holding the main world, render world, their schedules, and the extract-fn list.
- Event
Loop Waker - Cross-thread handle used to wake a parked platform event loop after
something is pushed onto a resource the tick loop doesn’t otherwise
observe until the next OS event - e.g.
lumen-mcp’sSimulateQueuefilling from the MCP server thread whilelumen-window-winit’s winit loop sits parked inabout_to_wait. Without a wakeup, injected input is invisible until an unrelated OS event (mouse move, resize, …) happens to tick the app. - Tick
- Schedule label for the main tick.
Enums§
- AppError
- Errors returned by builder methods that can fail.
Constants§
- LUMEN_
DEFAULT_ THREADS - Upper bound on the default worker count for the bevy_ecs task pool when
no plugin or env var raises it. One worker per main-stage band
(input / systems / layout / render). The effective default is
default_thread_budget=min(available_parallelism, LUMEN_DEFAULT_THREADS), so a 24-core box does not spawn a 24-wide pool for a UI that never saturates four workers.
Traits§
- Plugin
- Plugin trait registered via
App::add_plugin. - Plugin
Metadata - Type-erased plugin metadata recorded by
App::add_plugin.
Functions§
- default_
thread_ budget - Effective default worker budget:
LUMEN_DEFAULT_THREADScapped to the machine’s available parallelism. Falls back to 1 when parallelism is unknown. TheLUMEN_THREADSenv var (read in [ensure_task_pool]) andlumen.toml [runtime] threadsstill override this. - mark_
process_ start - Record the process-start instant. Idempotent - only the first call
wins, so calling it as the first statement of
maincaptures the earliest reachable moment. A no-op if already set. - process_
start - The process-start instant recorded by
mark_process_start, if any.