diff --git a/src/main.rs b/src/main.rs index 83ceb74..417e095 100644 --- a/src/main.rs +++ b/src/main.rs @@ -48,7 +48,7 @@ fn show_window ( application : & Application ) { let ui = UI :: new ( window , - |film_uuid| pinned_async ! { + async |film_uuid| { data_manager . get_film_details (film_uuid) . await . expect ("A film with the given UUID should exist") } , diff --git a/src/ui/mod.rs b/src/ui/mod.rs index d2ef8b1..c4fac8b 100644 --- a/src/ui/mod.rs +++ b/src/ui/mod.rs @@ -3,7 +3,6 @@ mod component ; mod utility ; use futures :: * ; -use futures :: future :: * ; use gtk4 :: Orientation :: * ; use gtk4 :: prelude :: * ; use libadwaita :: * ; @@ -27,7 +26,7 @@ pub struct UI { impl UI { pub fn new ( window : & 'static Window , - get_film_details : impl Fn (String) -> BoxFuture < 'static , FilmDetails > + 'static , + get_film_details : impl AsyncFn (String) -> FilmDetails + 'static , ) -> UI { let get_film_details = leak (get_film_details) ; diff --git a/src/utility.rs b/src/utility.rs index b6ba4ec..a5d7323 100644 --- a/src/utility.rs +++ b/src/utility.rs @@ -20,19 +20,10 @@ pub fn leak_mut < 'l , Type > ( inner : Type ) -> & 'l mut Type { Box :: leak ( Box :: new (inner) ) } -macro_rules ! pinned_async { ( - $ ( $ async_expression : expr ) ; + -) => { - Box :: pin ( async { - $ ( $ async_expression ) ; + - } ) -} } - pub fn to_os_string ( value : impl Display + Sized ) -> OsString { OsString :: from ( ToString :: to_string ( & value ) ) } -pub (crate) use concat_os_str ; -pub (crate) use pinned_async ; +# [ allow (unused_imports) ] pub (crate) use concat_os_str ;