@@ -45,6 +45,15 @@ crate::declare_vecs! {
4545 copy: wasmtime_component_valflags_copy,
4646 delete: wasmtime_component_valflags_delete,
4747 )
48+ (
49+ name: wasmtime_component_valmap_t,
50+ ty: wasmtime_component_valmap_entry_t,
51+ new: wasmtime_component_valmap_new,
52+ empty: wasmtime_component_valmap_new_empty,
53+ uninit: wasmtime_component_valmap_new_uninit,
54+ copy: wasmtime_component_valmap_copy,
55+ delete: wasmtime_component_valmap_delete,
56+ )
4857}
4958
5059impl From < & wasmtime_component_vallist_t > for Vec < Val > {
@@ -63,13 +72,43 @@ impl From<&[Val]> for wasmtime_component_vallist_t {
6372 }
6473}
6574
75+ impl From < & wasmtime_component_valmap_t > for Vec < ( Val , Val ) > {
76+ fn from ( value : & wasmtime_component_valmap_t ) -> Self {
77+ value
78+ . as_slice ( )
79+ . iter ( )
80+ . map ( |entry| ( Val :: from ( & entry. key ) , Val :: from ( & entry. value ) ) )
81+ . collect ( )
82+ }
83+ }
84+
85+ impl From < & [ ( Val , Val ) ] > for wasmtime_component_valmap_t {
86+ fn from ( value : & [ ( Val , Val ) ] ) -> Self {
87+ value
88+ . iter ( )
89+ . map ( |( k, v) | wasmtime_component_valmap_entry_t {
90+ key : wasmtime_component_val_t:: from ( k) ,
91+ value : wasmtime_component_val_t:: from ( v) ,
92+ } )
93+ . collect :: < Vec < _ > > ( )
94+ . into ( )
95+ }
96+ }
97+
6698#[ derive( Clone ) ]
6799#[ repr( C ) ]
68100pub struct wasmtime_component_valrecord_entry_t {
69101 name : wasm_name_t ,
70102 val : wasmtime_component_val_t ,
71103}
72104
105+ #[ derive( Clone , Default ) ]
106+ #[ repr( C ) ]
107+ pub struct wasmtime_component_valmap_entry_t {
108+ key : wasmtime_component_val_t ,
109+ value : wasmtime_component_val_t ,
110+ }
111+
73112impl Default for wasmtime_component_valrecord_entry_t {
74113 fn default ( ) -> Self {
75114 Self {
@@ -233,6 +272,7 @@ pub enum wasmtime_component_val_t {
233272 Option ( Option < Box < Self > > ) ,
234273 Result ( wasmtime_component_valresult_t ) ,
235274 Flags ( wasmtime_component_valflags_t ) ,
275+ Map ( wasmtime_component_valmap_t ) ,
236276 Resource ( Box < wasmtime_component_resource_any_t > ) ,
237277}
238278
@@ -275,6 +315,7 @@ impl From<&wasmtime_component_val_t> for Val {
275315 }
276316 wasmtime_component_val_t:: Result ( x) => Val :: Result ( x. into ( ) ) ,
277317 wasmtime_component_val_t:: Flags ( x) => Val :: Flags ( x. into ( ) ) ,
318+ wasmtime_component_val_t:: Map ( x) => Val :: Map ( x. into ( ) ) ,
278319 wasmtime_component_val_t:: Resource ( x) => Val :: Resource ( x. resource ) ,
279320 }
280321 }
@@ -309,6 +350,7 @@ impl From<&Val> for wasmtime_component_val_t {
309350 ) ,
310351 Val :: Result ( x) => wasmtime_component_val_t:: Result ( x. into ( ) ) ,
311352 Val :: Flags ( x) => wasmtime_component_val_t:: Flags ( x. as_slice ( ) . into ( ) ) ,
353+ Val :: Map ( x) => wasmtime_component_val_t:: Map ( x. as_slice ( ) . into ( ) ) ,
312354 Val :: Resource ( resource_any) => {
313355 wasmtime_component_val_t:: Resource ( Box :: new ( wasmtime_component_resource_any_t {
314356 resource : * resource_any,
0 commit comments