diff --git a/project/build.rs b/project/build.rs new file mode 100644 index 0000000..688393d --- /dev/null +++ b/project/build.rs @@ -0,0 +1,3 @@ +fn main() { + slint_build::compile("ui/app.slint").expect("Slint build failed"); +} diff --git a/project/src/app.rs b/project/src/app.rs new file mode 100644 index 0000000..7301814 --- /dev/null +++ b/project/src/app.rs @@ -0,0 +1,48 @@ +// Libraries +slint::include_modules!(); +use std::io::Result; + +// Macros +macro_rules! map_err { + ($expr:expr) => { + $expr.map_err(|e| std::io::Error::new(std::io::ErrorKind::Other, e)) + }; +} + +// Structures +pub struct App { + app: Prorater, +} + +// Implementations +impl App { + // Constructors + /// Creates a new App + /// + /// # Examples + /// ```rs + /// let app = App::new()?; + /// ``` + pub fn new() -> Result { + // Creating our new app + let app = map_err!(Prorater::new())?; + + // Returning Self + Ok(Self { app }) + } + + // Functions + /// Starts the Application + /// + /// # Examples + /// ```rs + /// app.start()?; + /// ``` + pub fn start(&self) -> Result<()> { + // Starting our application + map_err!(self.app.run())?; + + // Ok!! + Ok(()) + } +} diff --git a/project/src/backend.rs b/project/src/backend.rs new file mode 100644 index 0000000..e69de29 diff --git a/project/src/main.rs b/project/src/main.rs index e7a11a9..8cfd68c 100644 --- a/project/src/main.rs +++ b/project/src/main.rs @@ -1,3 +1,17 @@ -fn main() { - println!("Hello, world!"); +// Libaries +mod app; +use app::App; +mod backend; +use std::io::Result; + +// Entry Point +fn main() -> Result<()> { + // Creating a new App + let app = App::new()?; + + // Starting our App + app.start()?; + + // Ok!! + Ok(()) }