@@ -6,7 +6,7 @@ extern crate alloc;
6
6
slint:: include_modules!( ) ;
7
7
8
8
fn create_slint_app ( ) -> AppWindow {
9
- let ui = AppWindow :: new ( ) ;
9
+ let ui = AppWindow :: new ( ) . expect ( "Failed to load UI" ) ;
10
10
11
11
let ui_handle = ui. as_weak ( ) ;
12
12
ui. on_request_increase_value ( move || {
@@ -17,8 +17,8 @@ fn create_slint_app() -> AppWindow {
17
17
}
18
18
19
19
#[ cfg( feature = "simulator" ) ]
20
- fn main ( ) {
21
- create_slint_app ( ) . run ( ) ;
20
+ fn main ( ) -> Result < ( ) , slint :: PlatformError > {
21
+ create_slint_app ( ) . run ( )
22
22
}
23
23
24
24
#[ cfg( not( feature = "simulator" ) ) ]
@@ -93,21 +93,21 @@ fn main() -> ! {
93
93
. unwrap ( ) ;
94
94
95
95
// -------- Setup the Slint backend --------
96
- let window = slint:: platform:: software_renderer:: MinimalSoftwareWindow :: new ( ) ;
96
+ let window = slint:: platform:: software_renderer:: MinimalSoftwareWindow :: new ( Default :: default ( ) ) ;
97
97
slint:: platform:: set_platform ( alloc:: boxed:: Box :: new ( MyPlatform {
98
98
window : window. clone ( ) ,
99
99
timer,
100
100
} ) )
101
101
. unwrap ( ) ;
102
102
103
103
struct MyPlatform {
104
- window : alloc:: rc:: Rc < slint:: platform:: software_renderer:: MinimalSoftwareWindow < 1 > > ,
104
+ window : alloc:: rc:: Rc < slint:: platform:: software_renderer:: MinimalSoftwareWindow > ,
105
105
timer : hal:: Timer ,
106
106
}
107
107
108
108
impl slint:: platform:: Platform for MyPlatform {
109
- fn create_window_adapter ( & self ) -> alloc:: rc:: Rc < dyn slint:: platform:: WindowAdapter > {
110
- self . window . clone ( )
109
+ fn create_window_adapter ( & self ) -> Result < alloc:: rc:: Rc < dyn slint:: platform:: WindowAdapter > , slint :: PlatformError > {
110
+ Ok ( self . window . clone ( ) )
111
111
}
112
112
fn duration_since_start ( & self ) -> core:: time:: Duration {
113
113
core:: time:: Duration :: from_micros ( self . timer . get_counter ( ) )
0 commit comments