Express-Prorate/project/src/app.rs

48 lines
863 B
Rust

// 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<Self> {
// 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(())
}
}