Add async_unit_result_context, rename read_collection_file
This commit is contained in:
parent
5055583487
commit
1e9ff1057a
3 changed files with 25 additions and 12 deletions
25
src/main.rs
25
src/main.rs
|
@ -26,17 +26,20 @@ fn on_activate ( app : & Application ) {
|
|||
ui . show_window () ;
|
||||
|
||||
spawn_future_local ( async move {
|
||||
async_result_context ( async {
|
||||
let collection = spawn_blocking ( || read_collection_file () )
|
||||
. await ? ? ;
|
||||
ui . render_collection (collection) ;
|
||||
async_unit_result_context (
|
||||
async {
|
||||
let collection = spawn_blocking ( ||
|
||||
get_collection_from_file () ) . await ? ? ;
|
||||
ui . render_collection (collection) ;
|
||||
|
||||
Ok (())
|
||||
} , |_| () , |error| {
|
||||
match error {
|
||||
CollectionFileError => eprintln ! ("Could not open collection file") ,
|
||||
} ;
|
||||
ui . close_window () ;
|
||||
} ) . await ;
|
||||
Ok (())
|
||||
} ,
|
||||
|error| {
|
||||
match error {
|
||||
CollectionFileError => eprintln ! ("Could not open collection file") ,
|
||||
} ;
|
||||
ui . close_window () ;
|
||||
} ,
|
||||
) . await ;
|
||||
} ) ;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue