generated from OBJNULL/Dockerized-Rust
Created basic slint runtime
This commit is contained in:
parent
094209d19f
commit
78b3460019
4 changed files with 67 additions and 2 deletions
3
project/build.rs
Normal file
3
project/build.rs
Normal file
|
@ -0,0 +1,3 @@
|
|||
fn main() {
|
||||
slint_build::compile("ui/app.slint").expect("Slint build failed");
|
||||
}
|
48
project/src/app.rs
Normal file
48
project/src/app.rs
Normal file
|
@ -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<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(())
|
||||
}
|
||||
}
|
0
project/src/backend.rs
Normal file
0
project/src/backend.rs
Normal file
|
@ -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(())
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue