diff --git a/framework/base/src/types/interaction/tx.rs b/framework/base/src/types/interaction/tx.rs index 8a1f7899c5..e6fe8e4d94 100644 --- a/framework/base/src/types/interaction/tx.rs +++ b/framework/base/src/types/interaction/tx.rs @@ -644,19 +644,19 @@ where fn into_normalized(self) -> ContractCallWithEgld { self.payment.with_normalized( - &self.env, - &self.from, + self.env, + self.from, self.to, self.data, |norm_to, norm_egld, norm_fc| ContractCallWithEgld { basic: ContractCallNoPayment { _phantom: core::marker::PhantomData, - to: norm_to.clone(), + to: norm_to.clone_value(), function_call: norm_fc.clone(), explicit_gas_limit: UNSPECIFIED_GAS_LIMIT, _return_type: core::marker::PhantomData, }, - egld_payment: norm_egld.clone(), + egld_payment: norm_egld.clone_value(), }, ) } diff --git a/framework/base/src/types/interaction/tx_exec/tx_exec_async.rs b/framework/base/src/types/interaction/tx_exec/tx_exec_async.rs index 238b978139..b7f82557c9 100644 --- a/framework/base/src/types/interaction/tx_exec/tx_exec_async.rs +++ b/framework/base/src/types/interaction/tx_exec/tx_exec_async.rs @@ -126,14 +126,14 @@ where pub fn async_call_and_exit(self) -> ! { self.result_handler.save_callback_closure_to_storage(); self.payment.with_normalized( - &self.env, - &self.from, + self.env, + self.from, self.to, self.data.into(), |norm_to, norm_egld, norm_fc| { SendRawWrapper::::new().async_call_raw( - norm_to, - norm_egld, + &norm_to, + &norm_egld, &norm_fc.function_name, &norm_fc.arg_buffer, ) diff --git a/framework/base/src/types/interaction/tx_exec/tx_exec_async_promises.rs b/framework/base/src/types/interaction/tx_exec/tx_exec_async_promises.rs index ad8d8d4145..bf0474a85a 100644 --- a/framework/base/src/types/interaction/tx_exec/tx_exec_async_promises.rs +++ b/framework/base/src/types/interaction/tx_exec/tx_exec_async_promises.rs @@ -153,14 +153,14 @@ where let gas = self.gas.gas_value(&self.env); self.payment.with_normalized( - &self.env, - &self.from, + self.env, + self.from, self.to, self.data, |norm_to, norm_egld, norm_fc| { SendRawWrapper::::new().create_async_call_raw( - norm_to, - norm_egld, + &norm_to, + &norm_egld, &norm_fc.function_name, &norm_fc.arg_buffer, callback_name, diff --git a/framework/base/src/types/interaction/tx_exec/tx_exec_sync.rs b/framework/base/src/types/interaction/tx_exec/tx_exec_sync.rs index 78169a665b..f0298bce80 100644 --- a/framework/base/src/types/interaction/tx_exec/tx_exec_sync.rs +++ b/framework/base/src/types/interaction/tx_exec/tx_exec_sync.rs @@ -28,15 +28,15 @@ where let gas_limit = self.gas.gas_value(&self.env); let raw_result = self.payment.with_normalized( - &self.env, - &self.from, + self.env, + self.from, self.to, self.data.into(), |norm_to, norm_egld, norm_fc| { SendRawWrapper::::new().execute_on_dest_context_raw( gas_limit, - norm_to, - norm_egld, + &norm_to, + &norm_egld, &norm_fc.function_name, &norm_fc.arg_buffer, ) diff --git a/framework/base/src/types/interaction/tx_payment.rs b/framework/base/src/types/interaction/tx_payment.rs index ffbd552a4e..95f6f33613 100644 --- a/framework/base/src/types/interaction/tx_payment.rs +++ b/framework/base/src/types/interaction/tx_payment.rs @@ -16,7 +16,7 @@ pub use tx_payment_multi_esdt::TxPaymentMultiEsdt; use crate::{ api::ManagedTypeApi, - types::{BigUint, ManagedAddress, ManagedBuffer, MultiEsdtPayment}, + types::{BigUint, ManagedAddress, ManagedBuffer, ManagedRef, MultiEsdtPayment}, }; use super::{AnnotatedValue, FunctionCall, TxEnv, TxFrom, TxToSpecified}; @@ -42,8 +42,8 @@ where /// Converts an ESDT call to a built-in function call, if necessary. fn with_normalized( self, - env: &Env, - from: &From, + env: Env, + from: From, to: To, fc: FunctionCall, f: F, @@ -51,7 +51,11 @@ where where From: TxFrom, To: TxToSpecified, - F: FnOnce(&ManagedAddress, &BigUint, &FunctionCall) -> R; + F: FnOnce( + ManagedRef<'_, Env::Api, ManagedAddress>, + ManagedRef<'_, Env::Api, BigUint>, + FunctionCall, + ) -> R; /// Payment data to be used by the testing framework. Will be refactored. fn into_full_payment_data(self, env: &Env) -> FullPaymentData; diff --git a/framework/base/src/types/interaction/tx_payment/tx_payment_egld.rs b/framework/base/src/types/interaction/tx_payment/tx_payment_egld.rs index 161fdfea1e..c2aaee7b9f 100644 --- a/framework/base/src/types/interaction/tx_payment/tx_payment_egld.rs +++ b/framework/base/src/types/interaction/tx_payment/tx_payment_egld.rs @@ -1,7 +1,8 @@ use crate::{ contract_base::SendRawWrapper, types::{ - AnnotatedValue, BigUint, ManagedAddress, ManagedBuffer, ManagedVec, TxFrom, TxToSpecified, + AnnotatedValue, BigUint, ManagedAddress, ManagedBuffer, ManagedRef, ManagedVec, TxFrom, + TxToSpecified, }, }; @@ -45,8 +46,8 @@ where #[inline] fn with_normalized( self, - env: &Env, - _from: &From, + env: Env, + _from: From, to: To, fc: FunctionCall, f: F, @@ -54,11 +55,15 @@ where where From: TxFrom, To: TxToSpecified, - F: FnOnce(&ManagedAddress, &BigUint, &FunctionCall) -> R, + F: FnOnce( + ManagedRef<'_, Env::Api, ManagedAddress>, + ManagedRef<'_, Env::Api, BigUint>, + FunctionCall, + ) -> R, { - to.with_value_ref(env, |to_addr| { + to.with_value_ref(&env, |to_addr| { self.0 - .with_value_ref(env, |egld_value| f(to_addr, egld_value, &fc)) + .with_value_ref(&env, |egld_value| f(to_addr.into(), egld_value.into(), fc)) }) } diff --git a/framework/base/src/types/interaction/tx_payment/tx_payment_egld_or_esdt.rs b/framework/base/src/types/interaction/tx_payment/tx_payment_egld_or_esdt.rs index 8c5d62e49a..80f3017e47 100644 --- a/framework/base/src/types/interaction/tx_payment/tx_payment_egld_or_esdt.rs +++ b/framework/base/src/types/interaction/tx_payment/tx_payment_egld_or_esdt.rs @@ -1,4 +1,6 @@ -use crate::types::{BigUint, Egld, EgldOrEsdtTokenPayment, ManagedAddress, TxFrom, TxToSpecified}; +use crate::types::{ + BigUint, Egld, EgldOrEsdtTokenPayment, ManagedAddress, ManagedRef, TxFrom, TxToSpecified, +}; use super::{FullPaymentData, FunctionCall, TxEnv, TxPayment}; @@ -26,8 +28,8 @@ where fn with_normalized( self, - env: &Env, - from: &From, + env: Env, + from: From, to: To, fc: FunctionCall, f: F, @@ -35,12 +37,16 @@ where where From: TxFrom, To: TxToSpecified, - F: FnOnce(&ManagedAddress, &BigUint, &FunctionCall) -> R, + F: FnOnce( + ManagedRef<'_, Env::Api, ManagedAddress>, + ManagedRef<'_, Env::Api, BigUint>, + FunctionCall, + ) -> R, { self.map_ref_egld_or_esdt( - (to, fc, f), - |(to, fc, f), amount| Egld(amount).with_normalized(env, from, to, fc, f), - |(to, fc, f), esdt_payment| esdt_payment.with_normalized(env, from, to, fc, f), + (env, from, to, fc, f), + |(env, from, to, fc, f), amount| Egld(amount).with_normalized(env, from, to, fc, f), + |(env, from, to, fc, f), esdt_payment| esdt_payment.with_normalized(env, from, to, fc, f), ) } @@ -75,8 +81,8 @@ where fn with_normalized( self, - env: &Env, - from: &From, + env: Env, + from: From, to: To, fc: FunctionCall, f: F, @@ -84,12 +90,16 @@ where where From: TxFrom, To: TxToSpecified, - F: FnOnce(&ManagedAddress, &BigUint, &FunctionCall) -> R, + F: FnOnce( + ManagedRef<'_, Env::Api, ManagedAddress>, + ManagedRef<'_, Env::Api, BigUint>, + FunctionCall, + ) -> R, { self.map_egld_or_esdt( - (to, fc, f), - |(to, fc, f), amount| Egld(amount).with_normalized(env, from, to, fc, f), - |(to, fc, f), esdt_payment| esdt_payment.with_normalized(env, from, to, fc, f), + (env, from, to, fc, f), + |(env, from, to, fc, f), amount| Egld(amount).with_normalized(env, from, to, fc, f), + |(env, from, to, fc, f), esdt_payment| esdt_payment.with_normalized(env, from, to, fc, f), ) } diff --git a/framework/base/src/types/interaction/tx_payment/tx_payment_egld_or_esdt_refs.rs b/framework/base/src/types/interaction/tx_payment/tx_payment_egld_or_esdt_refs.rs index fe0bc1352d..42ff0024aa 100644 --- a/framework/base/src/types/interaction/tx_payment/tx_payment_egld_or_esdt_refs.rs +++ b/framework/base/src/types/interaction/tx_payment/tx_payment_egld_or_esdt_refs.rs @@ -1,4 +1,6 @@ -use crate::types::{BigUint, EgldOrEsdtTokenPaymentRefs, ManagedAddress, TxFrom, TxToSpecified}; +use crate::types::{ + BigUint, EgldOrEsdtTokenPaymentRefs, ManagedAddress, ManagedRef, TxFrom, TxToSpecified, +}; use super::{Egld, FullPaymentData, FunctionCall, TxEnv, TxPayment}; @@ -26,8 +28,8 @@ where fn with_normalized( self, - env: &Env, - from: &From, + env: Env, + from: From, to: To, fc: FunctionCall, f: F, @@ -35,12 +37,16 @@ where where From: TxFrom, To: TxToSpecified, - F: FnOnce(&ManagedAddress, &BigUint, &FunctionCall) -> R, + F: FnOnce( + ManagedRef<'_, Env::Api, ManagedAddress>, + ManagedRef<'_, Env::Api, BigUint>, + FunctionCall, + ) -> R, { self.map_egld_or_esdt( - (to, fc, f), - |(to, fc, f), amount| Egld(amount).with_normalized(env, from, to, fc, f), - |(to, fc, f), esdt_payment| esdt_payment.with_normalized(env, from, to, fc, f), + (env, from, to, fc, f), + |(env, from, to, fc, f), amount| Egld(amount).with_normalized(env, from, to, fc, f), + |(env, from, to, fc, f), esdt_payment| esdt_payment.with_normalized(env, from, to, fc, f), ) } diff --git a/framework/base/src/types/interaction/tx_payment/tx_payment_egld_or_multi_esdt.rs b/framework/base/src/types/interaction/tx_payment/tx_payment_egld_or_multi_esdt.rs index bde3528eb3..faf70d2c32 100644 --- a/framework/base/src/types/interaction/tx_payment/tx_payment_egld_or_multi_esdt.rs +++ b/framework/base/src/types/interaction/tx_payment/tx_payment_egld_or_multi_esdt.rs @@ -1,4 +1,6 @@ -use crate::types::{BigUint, EgldOrMultiEsdtPayment, ManagedAddress, TxFrom, TxToSpecified}; +use crate::types::{ + BigUint, EgldOrMultiEsdtPayment, ManagedAddress, ManagedRef, TxFrom, TxToSpecified, +}; use super::{FullPaymentData, FunctionCall, TxEnv, TxPayment}; @@ -25,8 +27,8 @@ where #[inline] fn with_normalized( self, - env: &Env, - from: &From, + env: Env, + from: From, to: To, fc: FunctionCall, f: F, @@ -34,7 +36,11 @@ where where From: TxFrom, To: TxToSpecified, - F: FnOnce(&ManagedAddress, &BigUint, &FunctionCall) -> R, + F: FnOnce( + ManagedRef<'_, Env::Api, ManagedAddress>, + ManagedRef<'_, Env::Api, BigUint>, + FunctionCall, + ) -> R, { self.as_refs().with_normalized(env, from, to, fc, f) } @@ -68,8 +74,8 @@ where #[inline] fn with_normalized( self, - env: &Env, - from: &From, + env: Env, + from: From, to: To, fc: FunctionCall, f: F, @@ -77,7 +83,11 @@ where where From: TxFrom, To: TxToSpecified, - F: FnOnce(&ManagedAddress, &BigUint, &FunctionCall) -> R, + F: FnOnce( + ManagedRef<'_, Env::Api, ManagedAddress>, + ManagedRef<'_, Env::Api, BigUint>, + FunctionCall, + ) -> R, { self.as_refs().with_normalized(env, from, to, fc, f) } diff --git a/framework/base/src/types/interaction/tx_payment/tx_payment_egld_or_multi_esdt_ref.rs b/framework/base/src/types/interaction/tx_payment/tx_payment_egld_or_multi_esdt_ref.rs index 2bce84e1ff..ae01a44645 100644 --- a/framework/base/src/types/interaction/tx_payment/tx_payment_egld_or_multi_esdt_ref.rs +++ b/framework/base/src/types/interaction/tx_payment/tx_payment_egld_or_multi_esdt_ref.rs @@ -1,4 +1,6 @@ -use crate::types::{BigUint, EgldOrMultiEsdtPaymentRefs, ManagedAddress, TxFrom, TxToSpecified}; +use crate::types::{ + BigUint, EgldOrMultiEsdtPaymentRefs, ManagedAddress, ManagedRef, TxFrom, TxToSpecified, +}; use super::{Egld, FullPaymentData, FunctionCall, TxEnv, TxPayment}; @@ -29,8 +31,8 @@ where fn with_normalized( self, - env: &Env, - from: &From, + env: Env, + from: From, to: To, fc: FunctionCall, f: F, @@ -38,7 +40,11 @@ where where From: TxFrom, To: TxToSpecified, - F: FnOnce(&ManagedAddress, &BigUint, &FunctionCall) -> R, + F: FnOnce( + ManagedRef<'_, Env::Api, ManagedAddress>, + ManagedRef<'_, Env::Api, BigUint>, + FunctionCall, + ) -> R, { match self { EgldOrMultiEsdtPaymentRefs::Egld(egld_amount) => { diff --git a/framework/base/src/types/interaction/tx_payment/tx_payment_multi_esdt.rs b/framework/base/src/types/interaction/tx_payment/tx_payment_multi_esdt.rs index 9541280dc6..b7db6af909 100644 --- a/framework/base/src/types/interaction/tx_payment/tx_payment_multi_esdt.rs +++ b/framework/base/src/types/interaction/tx_payment/tx_payment_multi_esdt.rs @@ -47,8 +47,8 @@ where fn with_normalized( self, - env: &Env, - from: &From, + env: Env, + from: From, to: To, fc: FunctionCall, f: F, @@ -56,14 +56,22 @@ where where From: TxFrom, To: TxToSpecified, - F: FnOnce(&ManagedAddress, &BigUint, &FunctionCall) -> R, + F: FnOnce( + ManagedRef<'_, Env::Api, ManagedAddress>, + ManagedRef<'_, Env::Api, BigUint>, + FunctionCall, + ) -> R, { match self.len() { 0 => ().with_normalized(env, from, to, fc, f), 1 => self.get(0).as_refs().with_normalized(env, from, to, fc, f), - _ => to.with_value_ref(env, |to_addr| { + _ => to.with_value_ref(&env, |to_addr| { let fc_conv = fc.convert_to_multi_transfer_esdt_call(to_addr, self); - f(&from.resolve_address(env), &*BigUint::zero_ref(), &fc_conv) + f( + (&from.resolve_address(&env)).into(), + BigUint::zero_ref(), + fc_conv, + ) }), } } @@ -100,8 +108,8 @@ where #[inline] fn with_normalized( self, - env: &Env, - from: &From, + env: Env, + from: From, to: To, fc: FunctionCall, f: F, @@ -109,7 +117,11 @@ where where From: TxFrom, To: TxToSpecified, - F: FnOnce(&ManagedAddress, &BigUint, &FunctionCall) -> R, + F: FnOnce( + ManagedRef<'_, Env::Api, ManagedAddress>, + ManagedRef<'_, Env::Api, BigUint>, + FunctionCall, + ) -> R, { self.deref().with_normalized(env, from, to, fc, f) } @@ -142,8 +154,8 @@ where #[inline] fn with_normalized( self, - env: &Env, - from: &From, + env: Env, + from: From, to: To, fc: FunctionCall, f: F, @@ -151,7 +163,11 @@ where where From: TxFrom, To: TxToSpecified, - F: FnOnce(&ManagedAddress, &BigUint, &FunctionCall) -> R, + F: FnOnce( + ManagedRef<'_, Env::Api, ManagedAddress>, + ManagedRef<'_, Env::Api, BigUint>, + FunctionCall, + ) -> R, { (&self).with_normalized(env, from, to, fc, f) } diff --git a/framework/base/src/types/interaction/tx_payment/tx_payment_none.rs b/framework/base/src/types/interaction/tx_payment/tx_payment_none.rs index 781f9a431a..92742dc253 100644 --- a/framework/base/src/types/interaction/tx_payment/tx_payment_none.rs +++ b/framework/base/src/types/interaction/tx_payment/tx_payment_none.rs @@ -1,4 +1,4 @@ -use crate::types::{BigUint, ManagedAddress, TxFrom, TxToSpecified}; +use crate::types::{BigUint, ManagedAddress, ManagedRef, TxFrom, TxToSpecified}; use super::{Egld, FullPaymentData, FunctionCall, TxEnv, TxPayment, TxPaymentEgldOnly}; @@ -25,8 +25,8 @@ where #[inline] fn with_normalized( self, - env: &Env, - _from: &From, + env: Env, + _from: From, to: To, fc: FunctionCall, f: F, @@ -34,9 +34,13 @@ where where From: TxFrom, To: TxToSpecified, - F: FnOnce(&ManagedAddress, &BigUint, &FunctionCall) -> R, + F: FnOnce( + ManagedRef<'_, Env::Api, ManagedAddress>, + ManagedRef<'_, Env::Api, BigUint>, + FunctionCall, + ) -> R, { - to.with_value_ref(env, |to_addr| f(to_addr, &*BigUint::zero_ref(), &fc)) + to.with_value_ref(&env, |to_addr| f(to_addr.into(), BigUint::zero_ref(), fc)) } fn into_full_payment_data(self, _env: &Env) -> FullPaymentData { diff --git a/framework/base/src/types/interaction/tx_payment/tx_payment_single_esdt.rs b/framework/base/src/types/interaction/tx_payment/tx_payment_single_esdt.rs index d5a87c4bde..d0d2bedead 100644 --- a/framework/base/src/types/interaction/tx_payment/tx_payment_single_esdt.rs +++ b/framework/base/src/types/interaction/tx_payment/tx_payment_single_esdt.rs @@ -1,5 +1,5 @@ use crate::types::{ - BigUint, EsdtTokenPayment, ManagedAddress, MultiEsdtPayment, TxFrom, TxToSpecified, + BigUint, EsdtTokenPayment, ManagedAddress, ManagedRef, MultiEsdtPayment, TxFrom, TxToSpecified, }; use super::{FullPaymentData, FunctionCall, TxEnv, TxPayment}; @@ -28,8 +28,8 @@ where #[inline] fn with_normalized( self, - env: &Env, - from: &From, + env: Env, + from: From, to: To, fc: FunctionCall, f: F, @@ -37,7 +37,11 @@ where where From: TxFrom, To: TxToSpecified, - F: FnOnce(&ManagedAddress, &BigUint, &FunctionCall) -> R, + F: FnOnce( + ManagedRef<'_, Env::Api, ManagedAddress>, + ManagedRef<'_, Env::Api, BigUint>, + FunctionCall, + ) -> R, { self.as_refs().with_normalized(env, from, to, fc, f) } @@ -74,8 +78,8 @@ where #[inline] fn with_normalized( self, - env: &Env, - from: &From, + env: Env, + from: From, to: To, fc: FunctionCall, f: F, @@ -83,7 +87,11 @@ where where From: TxFrom, To: TxToSpecified, - F: FnOnce(&ManagedAddress, &BigUint, &FunctionCall) -> R, + F: FnOnce( + ManagedRef<'_, Env::Api, ManagedAddress>, + ManagedRef<'_, Env::Api, BigUint>, + FunctionCall, + ) -> R, { self.as_refs().with_normalized(env, from, to, fc, f) } diff --git a/framework/base/src/types/interaction/tx_payment/tx_payment_single_esdt_ref.rs b/framework/base/src/types/interaction/tx_payment/tx_payment_single_esdt_ref.rs index 151f9c3598..9fc85f41f8 100644 --- a/framework/base/src/types/interaction/tx_payment/tx_payment_single_esdt_ref.rs +++ b/framework/base/src/types/interaction/tx_payment/tx_payment_single_esdt_ref.rs @@ -1,7 +1,8 @@ use crate::{ contract_base::SendRawWrapper, types::{ - BigUint, EsdtTokenPaymentRefs, ManagedAddress, MultiEsdtPayment, TxFrom, TxToSpecified, + BigUint, EsdtTokenPaymentRefs, ManagedAddress, ManagedRef, MultiEsdtPayment, TxFrom, + TxToSpecified, }, }; @@ -49,8 +50,8 @@ where fn with_normalized( self, - env: &Env, - from: &From, + env: Env, + from: From, to: To, fc: FunctionCall, f: F, @@ -58,15 +59,23 @@ where where From: TxFrom, To: TxToSpecified, - F: FnOnce(&ManagedAddress, &BigUint, &FunctionCall) -> R, + F: FnOnce( + ManagedRef<'_, Env::Api, ManagedAddress>, + ManagedRef<'_, Env::Api, BigUint>, + FunctionCall, + ) -> R, { - to.with_value_ref(env, |to_addr| { + to.with_value_ref(&env, |to_addr| { if self.token_nonce == 0 { let fc_conv = fc.convert_to_single_transfer_fungible_call(self); - f(to_addr, &*BigUint::zero_ref(), &fc_conv) + f(to_addr.into(), BigUint::zero_ref(), fc_conv) } else { let fc_conv = fc.convert_to_single_transfer_nft_call(to_addr, self); - f(&from.resolve_address(env), &*BigUint::zero_ref(), &fc_conv) + f( + ManagedRef::from(&from.resolve_address(&env)), + BigUint::zero_ref(), + fc_conv, + ) } }) } diff --git a/framework/base/src/types/interaction/tx_payment/tx_payment_single_esdt_triple.rs b/framework/base/src/types/interaction/tx_payment/tx_payment_single_esdt_triple.rs index 458e631a30..69e74a1c95 100644 --- a/framework/base/src/types/interaction/tx_payment/tx_payment_single_esdt_triple.rs +++ b/framework/base/src/types/interaction/tx_payment/tx_payment_single_esdt_triple.rs @@ -1,5 +1,5 @@ use crate::types::{ - BigUint, EsdtTokenPayment, ManagedAddress, TokenIdentifier, TxFrom, TxToSpecified, + BigUint, EsdtTokenPayment, ManagedAddress, ManagedRef, TokenIdentifier, TxFrom, TxToSpecified, }; use super::{FullPaymentData, FunctionCall, TxEnv, TxPayment}; @@ -26,8 +26,8 @@ where #[inline] fn with_normalized( self, - env: &Env, - from: &From, + env: Env, + from: From, to: To, fc: FunctionCall, f: F, @@ -35,7 +35,11 @@ where where From: TxFrom, To: TxToSpecified, - F: FnOnce(&ManagedAddress, &BigUint, &FunctionCall) -> R, + F: FnOnce( + ManagedRef<'_, Env::Api, ManagedAddress>, + ManagedRef<'_, Env::Api, BigUint>, + FunctionCall, + ) -> R, { EsdtTokenPayment::from(self).with_normalized(env, from, to, fc, f) } diff --git a/framework/base/src/types/managed/basic/big_uint.rs b/framework/base/src/types/managed/basic/big_uint.rs index eb34d765cf..4f8ecd7b1b 100644 --- a/framework/base/src/types/managed/basic/big_uint.rs +++ b/framework/base/src/types/managed/basic/big_uint.rs @@ -12,8 +12,7 @@ use crate::{ TopEncodeOutput, TryStaticCast, }, formatter::{hex_util::encode_bytes_as_hex, FormatBuffer, FormatByteReceiver, SCDisplay}, - proxy_imports::ManagedRef, - types::{heap::BoxedBytes, ManagedBuffer, ManagedBufferCachedBuilder, ManagedType}, + types::{heap::BoxedBytes, ManagedBuffer, ManagedBufferCachedBuilder, ManagedRef, ManagedType}, }; use super::cast_to_i64::cast_to_i64; diff --git a/framework/base/src/types/managed/wrapped/managed_ref.rs b/framework/base/src/types/managed/wrapped/managed_ref.rs index 143d79e1d4..888cf2aabd 100644 --- a/framework/base/src/types/managed/wrapped/managed_ref.rs +++ b/framework/base/src/types/managed/wrapped/managed_ref.rs @@ -9,6 +9,7 @@ use crate::{api::ManagedTypeApi, types::ManagedType}; /// A very efficient reference to a managed type, with copy semantics. /// /// It copies the handle and knows how to deref back. +#[repr(transparent)] pub struct ManagedRef<'a, M, T> where M: ManagedTypeApi, @@ -24,6 +25,7 @@ where M: ManagedTypeApi, T: ManagedType, { + #[inline] pub fn new(value: &'a T) -> Self { Self { _phantom_m: PhantomData,