From 1098a57ad41630dbf89d805db54b391ec586b7ad Mon Sep 17 00:00:00 2001 From: Benjamin DeMann Date: Thu, 31 Oct 2024 16:04:03 -0600 Subject: [PATCH] pr fixes --- .../rust/stable_canister_template/src/candid.rs | 5 +++-- .../rust/stable_canister_template/src/ic/mod.rs | 4 ++-- .../src/init_and_post_upgrade.rs | 9 +++++---- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/build/stable/commands/compile/wasm_binary/rust/stable_canister_template/src/candid.rs b/src/build/stable/commands/compile/wasm_binary/rust/stable_canister_template/src/candid.rs index 43574f7a5e..86bdc48227 100644 --- a/src/build/stable/commands/compile/wasm_binary/rust/stable_canister_template/src/candid.rs +++ b/src/build/stable/commands/compile/wasm_binary/rust/stable_canister_template/src/candid.rs @@ -5,7 +5,8 @@ use rquickjs::{Context, Function, Module, Object, Runtime}; use crate::{ error::{handle_promise_error, quickjs_call_with_error_handling}, - ic, quickjs_with_ctx, + ic::register, + quickjs_with_ctx, wasm_binary_manipulation::get_js_code, CONTEXT_REF_CELL, MODULE_NAME, }; @@ -39,7 +40,7 @@ fn initialize_and_get_candid() -> Result> { globals.set("_azleExperimental", false)?; - ic::register(ctx.clone())?; + register(ctx.clone())?; let js = get_js_code(); diff --git a/src/build/stable/commands/compile/wasm_binary/rust/stable_canister_template/src/ic/mod.rs b/src/build/stable/commands/compile/wasm_binary/rust/stable_canister_template/src/ic/mod.rs index 8a3a70b3d9..73b31dfa25 100644 --- a/src/build/stable/commands/compile/wasm_binary/rust/stable_canister_template/src/ic/mod.rs +++ b/src/build/stable/commands/compile/wasm_binary/rust/stable_canister_template/src/ic/mod.rs @@ -1,6 +1,6 @@ use std::fmt::Display; -use rquickjs::{Ctx, Error, Result, String}; +use rquickjs::{Ctx, Error, Object, Result, String}; mod accept_message; mod arg_data_raw; @@ -46,7 +46,7 @@ mod trap; #[allow(unused)] pub fn register(ctx: Ctx) -> Result<()> { - let ic = rquickjs::Object::new(ctx.clone())?; + let ic = Object::new(ctx.clone())?; ic.set("acceptMessage", accept_message::get_function(ctx.clone()))?; diff --git a/src/build/stable/commands/compile/wasm_binary/rust/stable_canister_template/src/init_and_post_upgrade.rs b/src/build/stable/commands/compile/wasm_binary/rust/stable_canister_template/src/init_and_post_upgrade.rs index 9b65c89198..2f7695502f 100644 --- a/src/build/stable/commands/compile/wasm_binary/rust/stable_canister_template/src/init_and_post_upgrade.rs +++ b/src/build/stable/commands/compile/wasm_binary/rust/stable_canister_template/src/init_and_post_upgrade.rs @@ -1,4 +1,4 @@ -use std::{error::Error, str}; +use std::{env, error::Error, str}; use ic_cdk::trap; use ic_stable_structures::memory_manager::MemoryId; @@ -8,7 +8,8 @@ use rquickjs::{Context, Module, Object, Runtime}; use crate::{ error::handle_promise_error, execute_method_js::execute_method_js, - ic, quickjs_with_ctx, + ic::register, + quickjs_with_ctx, wasm_binary_manipulation::{get_js_code, get_wasm_data}, CONTEXT_REF_CELL, MEMORY_MANAGER_REF_CELL, MODULE_NAME, WASM_DATA_REF_CELL, }; @@ -77,7 +78,7 @@ pub fn initialize_js( let env = Object::new(ctx.clone())?; - for (key, value) in std::env::vars() { + for (key, value) in env::vars() { env.set(key, value)?; } @@ -109,7 +110,7 @@ pub fn initialize_js( globals.set("_azleRecordBenchmarks", record_benchmarks)?; - ic::register(ctx.clone())?; + register(ctx.clone())?; let promise = Module::evaluate(ctx.clone(), MODULE_NAME, js)?;