Merge branch 'parse_as_target_no_async' into 'main'

Make VeilidAPI::parse_as_target a sync function

See merge request veilid/veilid!262
This commit is contained in:
Christien Rioux 2024-03-30 15:14:27 +00:00
commit 2ec00e18da
4 changed files with 7 additions and 7 deletions

View File

@ -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<S: ToString>(&self, s: S) -> VeilidAPIResult<Target> {
pub fn parse_as_target<S: ToString>(&self, s: S) -> VeilidAPIResult<Target> {
let s = s.to_string();
event!(target: "veilid_api", Level::DEBUG,

View File

@ -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
});

View File

@ -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
})

View File

@ -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)