From 87064f346bc69bd7cf92bfb75c2e624a06341b33 Mon Sep 17 00:00:00 2001 From: David Dal Busco Date: Thu, 28 May 2026 06:13:39 +0200 Subject: [PATCH] chore(sputnik): replace deprecated async_with! macro --- src/sputnik/src/js/runtime.rs | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/sputnik/src/js/runtime.rs b/src/sputnik/src/js/runtime.rs index 95a512b15a..c59f382026 100644 --- a/src/sputnik/src/js/runtime.rs +++ b/src/sputnik/src/js/runtime.rs @@ -7,7 +7,7 @@ use crate::js::apis::init_apis; use crate::js::dev::script::declare_dev_script; use crate::js::inner_utils::format_js_error; use rquickjs::{ - async_with, AsyncContext, AsyncRuntime, CatchResultExt, Context, Ctx, Error as JsError, Runtime, + AsyncContext, AsyncRuntime, CatchResultExt, Context, Ctx, Error as JsError, Runtime, }; pub trait RunAsyncJsFn { @@ -24,16 +24,17 @@ where .await .map_err(|e| format_js_error(JUNO_SPUTNIK_ERROR_RUNTIME_ASYNC_CONTEXT, e))?; - let result = async_with!(ctx => |ctx|{ - init_apis(&ctx).map_err(|e| format_js_error(JUNO_SPUTNIK_ERROR_RUNTIME_API_INIT, e))?; + let result = ctx + .async_with(async |ctx| { + init_apis(&ctx).map_err(|e| format_js_error(JUNO_SPUTNIK_ERROR_RUNTIME_API_INIT, e))?; - declare_dev_script(&ctx).map_err(|e| e.to_string())?; + declare_dev_script(&ctx).map_err(|e| e.to_string())?; - let result = f.run(&ctx).await.catch(&ctx).map_err(|e| e.to_string())?; + let result = f.run(&ctx).await.catch(&ctx).map_err(|e| e.to_string())?; - Ok::(result) - }) - .await?; + Ok::(result) + }) + .await?; rt.idle().await;