@@ -707,25 +707,24 @@ pub fn new(
707
707
) -> {wt}::Result<{struct_name}Indices> {{
708
708
let instance = component.get_export_index(None, \" {instance_name}\" )
709
709
.ok_or_else(|| anyhow::anyhow!(\" no exported instance named `{instance_name}`\" ))?;
710
- let instancetype = ctype.instance_type();
711
- Self::_new(instancetype , |name| component.get_export_index(Some(&instance), name))
710
+ let instance_type = ctype.instance_type();
711
+ Self::_new(&instance_type , |name| component.get_export_index(Some(&instance), name))
712
712
}}
713
713
714
714
/// This constructor is similar to [`{struct_name}Indices::new`] except that it
715
715
/// performs string lookups after instantiation time.
716
- pub fn new_instance<T> (
717
- store: & {wt}::Store<T> ,
716
+ pub fn new_instance(
717
+ mut store: impl {wt}::AsContextMut ,
718
718
instance: &{wt}::component::Instance,
719
719
) -> {wt}::Result<{struct_name}Indices> {{
720
- let store = &store;
721
- let instance_export = instance.get_export_index(store, None, \" {instance_name}\" )
720
+ let instance_export = instance.get_export_index(&mut store, None, \" {instance_name}\" )
722
721
.ok_or_else(|| anyhow::anyhow!(\" no exported instance named `{instance_name}`\" ))?;
723
- let instancetype = instance.instance_type(store);
724
- Self::_new(instancetype , |name| instance.get_export_index(store, Some(&instance_export), name))
722
+ let instance_type = instance.instance_type(&mut store);
723
+ Self::_new(&instance_type , |name| instance.get_export_index(&mut store, Some(&instance_export), name))
725
724
}}
726
725
727
726
fn _new(
728
- _instancetype: {wt}::component::__internal::InstanceType<'_> ,
727
+ _instance_type: & {wt}::component::__internal::InstanceType,
729
728
mut lookup: impl FnMut (&str) -> Option<{wt}::component::ComponentExportIndex>,
730
729
) -> {wt}::Result<{struct_name}Indices> {{
731
730
let mut lookup = move |name| {{
@@ -763,7 +762,7 @@ fn _new(
763
762
let mut store = store.as_context_mut();
764
763
let _ = &mut store;
765
764
let _instance = instance;
766
- let _instance_type = _instance.instance_type(&store);
765
+ let _instance_type = _instance.instance_type(&mut store);
767
766
"
768
767
) ;
769
768
let mut fields = Vec :: new ( ) ;
@@ -1070,6 +1069,7 @@ impl<_T> {camel}Pre<_T> {{
1070
1069
instance: &{wt}::component::Instance,
1071
1070
) -> {wt}::Result<Self> {{
1072
1071
let _instance = instance;
1072
+ let _instance_type = _instance.instance_type(&mut store);
1073
1073
" ,
1074
1074
) ;
1075
1075
for ( name, field) in self . exports . fields . iter ( ) {
@@ -1131,8 +1131,8 @@ impl<_T> {camel}Pre<_T> {{
1131
1131
mut store: impl {wt}::AsContextMut,
1132
1132
instance: &{wt}::component::Instance,
1133
1133
) -> {wt}::Result<{camel}> {{
1134
- let indices = {camel}Indices::new_instance(store, instance)?;
1135
- indices.load(store, instance)
1134
+ let indices = {camel}Indices::new_instance(&mut store, instance)?;
1135
+ indices.load(&mut store, instance)
1136
1136
}}
1137
1137
" ,
1138
1138
) ;
0 commit comments