From 8bf7b5b520247170940368674cfd15432e098378 Mon Sep 17 00:00:00 2001 From: bill fumerola Date: Fri, 22 Aug 2025 17:32:55 -0700 Subject: [PATCH] chore(rust): use generic instead of ZST the value is known at all the callsites. --- src/graph.rs | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/src/graph.rs b/src/graph.rs index 3fa12fa..96b9c14 100644 --- a/src/graph.rs +++ b/src/graph.rs @@ -417,13 +417,12 @@ impl CompositionGraph { .instantiate(&mut store, &component) .context(instantiate_package_error::ComponentInstantiationSnafu)?; - self.shadow_package( + self.shadow_package::( package, Rc::new(shadow_instance), linker, store, interfaces, - SyncInstanceShadower, ) } @@ -447,24 +446,22 @@ impl CompositionGraph { .await .context(instantiate_package_error::ComponentInstantiationSnafu)?; - self.shadow_package( + self.shadow_package::( package, Rc::new(shadow_instance), linker, store, interfaces, - AsyncInstanceShadower, ) } - fn shadow_package( + fn shadow_package>( &self, package: &Package, shadow_instance: Rc, linker: &mut component::Linker, mut store: impl AsContextMut, interfaces: &IndexSet, - shadower: impl InstanceShadower, ) -> Result<(), InstantiatePackageError> { for interface_name in interfaces { let interface_path = ForeignInterfacePath::new( @@ -515,7 +512,7 @@ impl CompositionGraph { func_name: export_name.to_string(), })?; - shadower.shadow_func( + T::shadow_func( &mut front_instance, export_name, shadow_func, @@ -564,7 +561,6 @@ impl Deref for PackageWrapper { trait InstanceShadower { fn shadow_func( - &self, instance: &mut LinkerInstance, export_name: &str, shadow_func: component::Func, @@ -579,7 +575,6 @@ struct SyncInstanceShadower; impl InstanceShadower for SyncInstanceShadower { fn shadow_func( - &self, instance: &mut LinkerInstance, export_name: &str, shadow_func: component::Func, @@ -628,7 +623,6 @@ impl InstanceShadower for AsyncInstanceShadower { fn shadow_func( - &self, instance: &mut LinkerInstance, export_name: &str, shadow_func: component::Func,