@@ -2,6 +2,8 @@ use std::sync::Arc;
22
33use algokit_abi:: ABIType as RustABIType ;
44
5+ use crate :: abi:: abi_value:: ABIValue ;
6+
57use super :: { ABIType , FfiToRustABIType , RustToFfiABIType } ;
68
79#[ derive( uniffi:: Object , Clone ) ]
@@ -29,8 +31,34 @@ impl From<RustABIType> for ABIDynamicArray {
2931
3032impl FfiToRustABIType for ABIDynamicArray {
3133 fn to_rust_abi_type ( & self ) -> RustABIType {
32- ( * self ) . clone ( ) . into ( )
34+ eprintln ! ( "DEBUGPRINT[43]: dynamic_array.rs:34 (before let cloned = self.clone();)" ) ;
35+ let cloned = self . clone ( ) ;
36+ eprintln ! ( "DEBUGPRINT[44]: dynamic_array.rs:35 (after let cloned = self.clone();)" ) ;
37+
38+ eprintln ! ( "DEBUGPRINT[46]: dynamic_array.rs:38 (before cloned.into())" ) ;
39+ let res = cloned. into ( ) ;
40+ eprintln ! ( "DEBUGPRINT[47]: dynamic_array.rs:39 (after cloned.into())" ) ;
41+ res
3342 }
3443}
3544
36- impl ABIType for ABIDynamicArray { }
45+ #[ uniffi:: export]
46+ impl ABIType for ABIDynamicArray {
47+ fn decoode ( & self , data : & [ u8 ] ) -> ABIValue {
48+ let rust_abi_type = self . to_rust_abi_type ( ) ;
49+ ABIValue :: from ( rust_abi_type. decode ( data) . unwrap ( ) )
50+ }
51+
52+ fn encode ( & self , value : ABIValue ) -> Vec < u8 > {
53+ let rust_abi_type = self . to_rust_abi_type ( ) ;
54+ rust_abi_type. encode ( & value. into ( ) ) . unwrap ( )
55+ }
56+ }
57+
58+ #[ uniffi:: export]
59+ impl ABIDynamicArray {
60+ #[ uniffi:: constructor]
61+ pub fn new ( element_type : Arc < dyn ABIType > ) -> Self {
62+ ABIDynamicArray { element_type }
63+ }
64+ }
0 commit comments