Skip to main content

rosace_core/
app.rs

1use crate::element::Element;
2
3/// Top-level application builder.
4///
5/// Holds the root element and (in future phases) the platform event-loop
6/// handle, window configuration, and service registrations.
7pub struct App {
8    root: Option<Element>,
9}
10
11impl App {
12    /// Creates a new `App` with no root element.
13    pub fn new() -> Self {
14        App { root: None }
15    }
16
17    /// Sets the root element of the application.
18    pub fn child(mut self, element: impl Into<Element>) -> Self {
19        self.root = Some(element.into());
20        self
21    }
22
23    /// Starts the application event loop.
24    ///
25    /// # Phase 1 placeholder
26    ///
27    /// The real event loop is wired in `rosace-render` (GPU path) and
28    /// `rosace-cli` (terminal path). This stub exists so application entry
29    /// points compile against `rosace-core` without pulling in renderer crates.
30    pub fn run(self) {
31        todo!("wire up in rosace-render/rosace-cli")
32    }
33}
34
35impl Default for App {
36    fn default() -> Self {
37        App::new()
38    }
39}