Skip to content
6 changes: 5 additions & 1 deletion framework/base/src/types/interaction/managed_arg_buffer.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::{
abi::{TypeAbi, TypeAbiFrom, TypeName},
api::{ErrorApi, ManagedTypeApi, use_raw_handle},
api::{ErrorApi, ManagedTypeApi, ManagedTypeApiImpl, use_raw_handle},
codec::{
DecodeErrorHandler, EncodeErrorHandler, NestedDecode, NestedDecodeInput, NestedEncode,
NestedEncodeOutput, TopDecode, TopDecodeInput, TopEncode, TopEncodeMultiOutput,
Expand Down Expand Up @@ -340,6 +340,10 @@ where
fn save_to_payload(self, payload: &mut Self::PAYLOAD) {
self.data.save_to_payload(payload);
}

fn requires_drop() -> bool {
M::managed_type_impl().requires_managed_type_drop()
}
}

impl<M: ManagedTypeApi> PartialEq for ManagedArgBuffer<M> {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use crate::{
abi::TypeAbiFrom,
api::ManagedTypeApiImpl,
codec::{
DecodeErrorHandler, EncodeErrorHandler, MultiValueConstLength, TopDecodeMulti,
TopDecodeMultiInput, TopEncodeMulti, TopEncodeMultiOutput, multi_types::MultiValue3,
Expand Down Expand Up @@ -50,6 +51,10 @@ impl<M: ManagedTypeApi> ManagedVecItem for EgldOrEsdtTokenPaymentMultiValue<M> {
fn save_to_payload(self, payload: &mut Self::PAYLOAD) {
self.obj.save_to_payload(payload);
}

fn requires_drop() -> bool {
M::managed_type_impl().requires_managed_type_drop()
}
}

impl<M> TopEncodeMulti for EgldOrEsdtTokenPaymentMultiValue<M>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use crate::{
abi::TypeAbiFrom,
api::ManagedTypeApiImpl,
codec::{
DecodeErrorHandler, EncodeErrorHandler, MultiValueConstLength, TopDecodeMulti,
TopDecodeMultiInput, TopEncodeMulti, TopEncodeMultiOutput, multi_types::MultiValue3,
Expand Down Expand Up @@ -56,6 +57,10 @@ impl<M: ManagedTypeApi> ManagedVecItem for EsdtTokenPaymentMultiValue<M> {
fn save_to_payload(self, payload: &mut Self::PAYLOAD) {
self.obj.save_to_payload(payload);
}

fn requires_drop() -> bool {
M::managed_type_impl().requires_managed_type_drop()
}
}

impl<M> TopEncodeMulti for EsdtTokenPaymentMultiValue<M>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,10 @@ where
}

#[allow(clippy::redundant_closure)]
pub fn slice(&self, start_index: usize, end_index: usize) -> Option<Self> {
pub fn slice(&self, start_index: usize, end_index: usize) -> Option<Self>
where
T: Clone,
{
self.0
.slice(start_index, end_index)
.map(|value| Self(value))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use core::borrow::Borrow;

use crate::{
abi::{TypeAbi, TypeAbiFrom, TypeDescriptionContainer, TypeName},
api::ManagedTypeApi,
api::{ManagedTypeApi, ManagedTypeApiImpl},
codec::{
DecodeErrorHandler, EncodeErrorHandler, TopDecodeMulti, TopDecodeMultiInput,
TopEncodeMulti, TopEncodeMultiOutput,
Expand Down Expand Up @@ -111,6 +111,10 @@ where
fn save_to_payload(self, payload: &mut Self::PAYLOAD) {
self.contents.save_to_payload(payload);
}

fn requires_drop() -> bool {
M::managed_type_impl().requires_managed_type_drop()
}
}

impl<M, T> TopEncodeMulti for MultiValueManagedVecCounted<M, T>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use crate::{
abi::TypeAbiFrom,
api::ManagedTypeApiImpl,
codec::{
DecodeErrorHandler, EncodeErrorHandler, MultiValueConstLength, TopDecodeMulti,
TopDecodeMultiInput, TopEncodeMulti, TopEncodeMultiOutput, multi_types::MultiValue3,
Expand Down Expand Up @@ -50,6 +51,10 @@ impl<M: ManagedTypeApi> ManagedVecItem for PaymentMultiValue<M> {
fn save_to_payload(self, payload: &mut Self::PAYLOAD) {
self.obj.save_to_payload(payload);
}

fn requires_drop() -> bool {
M::managed_type_impl().requires_managed_type_drop()
}
}

impl<M> TopEncodeMulti for PaymentMultiValue<M>
Expand Down
10 changes: 9 additions & 1 deletion framework/base/src/types/managed/wrapped/managed_decimal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pub use managed_decimal_signed::ManagedDecimalSigned;

use crate::{
abi::{TypeAbi, TypeAbiFrom, TypeName},
api::ManagedTypeApi,
api::{ManagedTypeApi, ManagedTypeApiImpl},
formatter::{FormatBuffer, FormatByteReceiver, SCDisplay},
typenum::{U4, U8, Unsigned},
types::BigUint,
Expand Down Expand Up @@ -167,6 +167,10 @@ impl<M: ManagedTypeApi> ManagedVecItem for ManagedDecimal<M, NumDecimals> {
managed_vec_item_save_to_payload_index(self.decimals, payload, &mut index);
}
}

fn requires_drop() -> bool {
M::managed_type_impl().requires_managed_type_drop()
}
}

impl<M: ManagedTypeApi, DECIMALS: Unsigned> ManagedVecItem
Expand All @@ -189,6 +193,10 @@ impl<M: ManagedTypeApi, DECIMALS: Unsigned> ManagedVecItem
fn save_to_payload(self, payload: &mut Self::PAYLOAD) {
self.data.save_to_payload(payload);
}

fn requires_drop() -> bool {
M::managed_type_impl().requires_managed_type_drop()
}
}

impl<M: ManagedTypeApi, DECIMALS: Unsigned> TopEncode
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use crate::{
abi::{TypeAbi, TypeAbiFrom, TypeName},
api::{
BigFloatApiImpl, BigIntApiImpl, HandleConstraints, ManagedBufferApiImpl, ManagedTypeApi,
const_handles, use_raw_handle,
ManagedTypeApiImpl, const_handles, use_raw_handle,
},
err_msg,
formatter::{FormatBuffer, FormatByteReceiver, SCDisplay},
Expand Down Expand Up @@ -217,6 +217,10 @@ impl<M: ManagedTypeApi> ManagedVecItem for ManagedDecimalSigned<M, NumDecimals>
managed_vec_item_save_to_payload_index(self.decimals, payload, &mut index);
}
}

fn requires_drop() -> bool {
M::managed_type_impl().requires_managed_type_drop()
}
}

impl<M: ManagedTypeApi, DECIMALS: Unsigned> ManagedVecItem
Expand All @@ -239,6 +243,10 @@ impl<M: ManagedTypeApi, DECIMALS: Unsigned> ManagedVecItem
fn save_to_payload(self, payload: &mut Self::PAYLOAD) {
self.data.save_to_payload(payload);
}

fn requires_drop() -> bool {
M::managed_type_impl().requires_managed_type_drop()
}
}

impl<M: ManagedTypeApi, DECIMALS: Unsigned> TopEncode
Expand Down
6 changes: 5 additions & 1 deletion framework/base/src/types/managed/wrapped/managed_option.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use generic_array::typenum::U4;

use crate::{
abi::TypeAbiFrom,
api::HandleConstraints,
api::{HandleConstraints, ManagedTypeApiImpl},
codec::{
DecodeErrorHandler, EncodeErrorHandler, NestedDecode, NestedDecodeInput, NestedEncode,
NestedEncodeOutput, TopDecode, TopDecodeInput, TopEncode, TopEncodeOutput,
Expand Down Expand Up @@ -221,6 +221,10 @@ where
fn save_to_payload(self, payload: &mut Self::PAYLOAD) {
self.handle.get_raw_handle().save_to_payload(payload);
}

fn requires_drop() -> bool {
M::managed_type_impl().requires_managed_type_drop()
}
}

impl<M, T> TopEncode for ManagedOption<M, T>
Expand Down
Loading
Loading