@@ -415,13 +415,12 @@ impl<D, C: Clone> CompositionGraph<D, C> {
415415 . instantiate ( & mut store, & component)
416416 . context ( instantiate_package_error:: ComponentInstantiationSnafu ) ?;
417417
418- self . shadow_package (
418+ self . shadow_package :: < SyncInstanceShadower > (
419419 package,
420420 Rc :: new ( shadow_instance) ,
421421 linker,
422422 store,
423423 interfaces,
424- SyncInstanceShadower ,
425424 )
426425 }
427426
@@ -445,24 +444,22 @@ impl<D, C: Clone> CompositionGraph<D, C> {
445444 . await
446445 . context ( instantiate_package_error:: ComponentInstantiationSnafu ) ?;
447446
448- self . shadow_package (
447+ self . shadow_package :: < AsyncInstanceShadower > (
449448 package,
450449 Rc :: new ( shadow_instance) ,
451450 linker,
452451 store,
453452 interfaces,
454- AsyncInstanceShadower ,
455453 )
456454 }
457455
458- fn shadow_package (
456+ fn shadow_package < T : InstanceShadower < D , C > > (
459457 & self ,
460458 package : & Package ,
461459 shadow_instance : Rc < Instance > ,
462460 linker : & mut component:: Linker < D > ,
463461 mut store : impl AsContextMut < Data = D > ,
464462 interfaces : & IndexSet < String > ,
465- shadower : impl InstanceShadower < D , C > ,
466463 ) -> Result < ( ) , InstantiatePackageError > {
467464 for interface_name in interfaces {
468465 let interface_path = ForeignInterfacePath :: new (
@@ -513,7 +510,7 @@ impl<D, C: Clone> CompositionGraph<D, C> {
513510 func_name : export_name. to_string ( ) ,
514511 } ) ?;
515512
516- shadower . shadow_func (
513+ T :: shadow_func (
517514 & mut front_instance,
518515 export_name,
519516 shadow_func,
@@ -561,7 +558,6 @@ impl Deref for PackageWrapper {
561558
562559trait InstanceShadower < D , C : Clone > {
563560 fn shadow_func (
564- & self ,
565561 instance : & mut LinkerInstance < D > ,
566562 export_name : & str ,
567563 shadow_func : component:: Func ,
@@ -576,7 +572,6 @@ struct SyncInstanceShadower;
576572
577573impl < D : ' static , C : Clone + Send + Sync + ' static > InstanceShadower < D , C > for SyncInstanceShadower {
578574 fn shadow_func (
579- & self ,
580575 instance : & mut LinkerInstance < D > ,
581576 export_name : & str ,
582577 shadow_func : component:: Func ,
@@ -625,7 +620,6 @@ impl<D: Send + 'static, C: Clone + Send + Sync + 'static> InstanceShadower<D, C>
625620 for AsyncInstanceShadower
626621{
627622 fn shadow_func (
628- & self ,
629623 instance : & mut LinkerInstance < D > ,
630624 export_name : & str ,
631625 shadow_func : component:: Func ,
0 commit comments