From b5cf325c5a88db42343d60e4f53ce9ea385a22b2 Mon Sep 17 00:00:00 2001 From: Sashanoraa Date: Thu, 28 Mar 2024 13:38:41 -0400 Subject: [PATCH] Make VeilidAPI::parse_as_target a sync function VeilidAPI::parse_as_target doesn't perform any async operations so it should be a sync function. --- veilid-core/src/veilid_api/api.rs | 2 +- veilid-flutter/rust/src/dart_ffi.rs | 4 ++-- veilid-wasm/src/lib.rs | 4 ++-- veilid-wasm/src/veilid_routing_context_js.rs | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/veilid-core/src/veilid_api/api.rs b/veilid-core/src/veilid_api/api.rs index d455fa42..e6499bd9 100644 --- a/veilid-core/src/veilid_api/api.rs +++ b/veilid-core/src/veilid_api/api.rs @@ -217,7 +217,7 @@ impl VeilidAPI { /// `XmnGyJrjMJBRC5ayJZRPXWTBspdX36-pbLb98H3UMeE` will be parsed with the 'best' cryptosystem /// available (at the time of this writing this is `VLD0`) #[instrument(target = "veilid_api", level = "debug", skip(self), fields(s=s.to_string()), ret, err)] - pub async fn parse_as_target(&self, s: S) -> VeilidAPIResult { + pub fn parse_as_target(&self, s: S) -> VeilidAPIResult { let s = s.to_string(); event!(target: "veilid_api", Level::DEBUG, diff --git a/veilid-flutter/rust/src/dart_ffi.rs b/veilid-flutter/rust/src/dart_ffi.rs index a6541d4e..f045ae4b 100644 --- a/veilid-flutter/rust/src/dart_ffi.rs +++ b/veilid-flutter/rust/src/dart_ffi.rs @@ -568,7 +568,7 @@ pub extern "C" fn routing_context_app_call(port: i64, id: u32, target: FfiStr, r let routing_context = get_routing_context(id, "routing_context_app_call")?; let veilid_api = get_veilid_api().await?; - let target = veilid_api.parse_as_target(target_string).await?; + let target = veilid_api.parse_as_target(target_string)?; let answer = routing_context.app_call(target, request).await?; let answer = data_encoding::BASE64URL_NOPAD.encode(&answer); APIResult::Ok(answer) @@ -585,7 +585,7 @@ pub extern "C" fn routing_context_app_message(port: i64, id: u32, target: FfiStr let routing_context = get_routing_context(id, "routing_context_app_message")?; let veilid_api = get_veilid_api().await?; - let target = veilid_api.parse_as_target(target_string).await?; + let target = veilid_api.parse_as_target(target_string)?; routing_context.app_message(target, message).await?; APIRESULT_VOID }); diff --git a/veilid-wasm/src/lib.rs b/veilid-wasm/src/lib.rs index 53d48b21..1fd778be 100644 --- a/veilid-wasm/src/lib.rs +++ b/veilid-wasm/src/lib.rs @@ -470,7 +470,7 @@ pub fn routing_context_app_call(id: u32, target_string: String, request: String) let routing_context = get_routing_context(id, "routing_context_app_call")?; let veilid_api = get_veilid_api()?; - let target = veilid_api.parse_as_target(target_string).await?; + let target = veilid_api.parse_as_target(target_string)?; let answer = routing_context.app_call(target, request).await?; let answer = data_encoding::BASE64URL_NOPAD.encode(&answer); APIResult::Ok(answer) @@ -486,7 +486,7 @@ pub fn routing_context_app_message(id: u32, target_string: String, message: Stri let routing_context = get_routing_context(id, "routing_context_app_message")?; let veilid_api = get_veilid_api()?; - let target = veilid_api.parse_as_target(target_string).await?; + let target = veilid_api.parse_as_target(target_string)?; routing_context.app_message(target, message).await?; APIRESULT_UNDEFINED }) diff --git a/veilid-wasm/src/veilid_routing_context_js.rs b/veilid-wasm/src/veilid_routing_context_js.rs index 4a7201d7..0834ac4a 100644 --- a/veilid-wasm/src/veilid_routing_context_js.rs +++ b/veilid-wasm/src/veilid_routing_context_js.rs @@ -161,7 +161,7 @@ impl VeilidRoutingContext { let routing_context = self.getRoutingContext()?; let message = message.into_vec(); let veilid_api = get_veilid_api()?; - let target = veilid_api.parse_as_target(target_string).await?; + let target = veilid_api.parse_as_target(target_string)?; routing_context.app_message(target, message).await?; APIRESULT_UNDEFINED } @@ -183,7 +183,7 @@ impl VeilidRoutingContext { let routing_context = self.getRoutingContext()?; let veilid_api = get_veilid_api()?; - let target = veilid_api.parse_as_target(target_string).await?; + let target = veilid_api.parse_as_target(target_string)?; let answer = routing_context.app_call(target, request).await?; let answer = Uint8Array::from(answer.as_slice()); APIResult::Ok(answer)