From 31c3a9a3e2382352a66c3630331153e2300b1954 Mon Sep 17 00:00:00 2001 From: Andrei Marinica Date: Thu, 28 Nov 2024 19:13:37 +0200 Subject: [PATCH] ManagedVecItem - lo longer implemented for handles directly --- .../base/src/api/managed_types/handles.rs | 7 ++---- .../src/api/impl_vh/debug_handle_vh.rs | 23 +------------------ 2 files changed, 3 insertions(+), 27 deletions(-) diff --git a/framework/base/src/api/managed_types/handles.rs b/framework/base/src/api/managed_types/handles.rs index 5a8f17ba9d..4c4c89a719 100644 --- a/framework/base/src/api/managed_types/handles.rs +++ b/framework/base/src/api/managed_types/handles.rs @@ -10,15 +10,12 @@ pub trait HandleTypeInfo { use crate::codec::TryStaticCast; -use crate::{ - api::{ErrorApi, ErrorApiImpl}, - types::ManagedVecItem, -}; +use crate::api::{ErrorApi, ErrorApiImpl}; pub type RawHandle = i32; pub trait HandleConstraints: - ManagedVecItem + TryStaticCast + Debug + Clone + From + PartialEq + PartialEq + TryStaticCast + Debug + Clone + From + PartialEq + PartialEq { fn new(handle: RawHandle) -> Self; fn to_be_bytes(&self) -> [u8; 4]; diff --git a/framework/scenario/src/api/impl_vh/debug_handle_vh.rs b/framework/scenario/src/api/impl_vh/debug_handle_vh.rs index 64fcd15fa9..5c2a60c022 100644 --- a/framework/scenario/src/api/impl_vh/debug_handle_vh.rs +++ b/framework/scenario/src/api/impl_vh/debug_handle_vh.rs @@ -1,8 +1,7 @@ use multiversx_chain_vm::tx_mock::{TxContext, TxContextStack}; use multiversx_sc::{ - api::{use_raw_handle, HandleConstraints, RawHandle}, + api::{HandleConstraints, RawHandle}, codec::TryStaticCast, - types::ManagedVecItem, }; use std::sync::Arc; @@ -76,24 +75,4 @@ impl From for DebugHandle { } } -impl ManagedVecItem for DebugHandle { - type PAYLOAD = ::PAYLOAD; - - const SKIPS_RESERIALIZATION: bool = ::SKIPS_RESERIALIZATION; - - type Ref<'a> = Self; - - fn read_from_payload(payload: &Self::PAYLOAD) -> Self { - use_raw_handle(RawHandle::read_from_payload(payload)) - } - - unsafe fn borrow_from_payload<'a>(payload: &Self::PAYLOAD) -> Self::Ref<'a> { - Self::read_from_payload(payload) - } - - fn save_to_payload(self, payload: &mut Self::PAYLOAD) { - self.get_raw_handle().save_to_payload(payload); - } -} - impl TryStaticCast for DebugHandle {}