File tree 9 files changed +10
-10
lines changed
factor-outbound-networking/src
9 files changed +10
-10
lines changed Original file line number Diff line number Diff line change @@ -102,6 +102,7 @@ impl Factor for KeyValueFactor {
102
102
}
103
103
104
104
fn prepare < T : RuntimeFactors > (
105
+ & self ,
105
106
ctx : PrepareContext < Self > ,
106
107
_builders : & mut InstanceBuilders < T > ,
107
108
) -> anyhow:: Result < InstanceBuilder > {
Original file line number Diff line number Diff line change @@ -36,6 +36,7 @@ impl Factor for OutboundHttpFactor {
36
36
}
37
37
38
38
fn prepare < T : RuntimeFactors > (
39
+ & self ,
39
40
_ctx : PrepareContext < Self > ,
40
41
builders : & mut InstanceBuilders < T > ,
41
42
) -> anyhow:: Result < Self :: InstanceBuilder > {
Original file line number Diff line number Diff line change @@ -49,6 +49,7 @@ impl Factor for OutboundNetworkingFactor {
49
49
}
50
50
51
51
fn prepare < T : RuntimeFactors > (
52
+ & self ,
52
53
ctx : PrepareContext < Self > ,
53
54
builders : & mut InstanceBuilders < T > ,
54
55
) -> anyhow:: Result < Self :: InstanceBuilder > {
Original file line number Diff line number Diff line change @@ -81,6 +81,7 @@ impl Factor for VariablesFactor {
81
81
}
82
82
83
83
fn prepare < T : RuntimeFactors > (
84
+ & self ,
84
85
ctx : PrepareContext < Self > ,
85
86
_builders : & mut InstanceBuilders < T > ,
86
87
) -> anyhow:: Result < InstanceState > {
Original file line number Diff line number Diff line change @@ -78,6 +78,7 @@ impl Factor for WasiFactor {
78
78
}
79
79
80
80
fn prepare < T : RuntimeFactors > (
81
+ & self ,
81
82
ctx : PrepareContext < Self > ,
82
83
_builders : & mut InstanceBuilders < T > ,
83
84
) -> anyhow:: Result < InstanceBuilder > {
@@ -92,8 +93,7 @@ impl Factor for WasiFactor {
92
93
let mount_ctx = MountFilesContext {
93
94
wasi_ctx : & mut wasi_ctx,
94
95
} ;
95
- ctx. factor ( )
96
- . files_mounter
96
+ self . files_mounter
97
97
. mount_files ( ctx. app_component ( ) , mount_ctx) ?;
98
98
99
99
Ok ( InstanceBuilder { wasi_ctx } )
Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ impl Factor for WasiPreview1Factor {
23
23
}
24
24
25
25
fn prepare < T : RuntimeFactors > (
26
+ & self ,
26
27
_ctx : spin_factors:: PrepareContext < Self > ,
27
28
_builders : & mut spin_factors:: InstanceBuilders < T > ,
28
29
) -> anyhow:: Result < Self :: InstanceBuilder > {
Original file line number Diff line number Diff line change @@ -121,8 +121,8 @@ fn expand_factors(input: &DeriveInput) -> syn::Result<TokenStream> {
121
121
#(
122
122
builders. #factor_names = Some (
123
123
#Factor :: prepare:: <Self >(
124
+ & self . #factor_names,
124
125
#factors_path:: PrepareContext :: new(
125
- & self . #factor_names,
126
126
configured_app. app_state:: <#factor_types>( ) . unwrap( ) ,
127
127
& app_component,
128
128
) ,
Original file line number Diff line number Diff line change @@ -38,6 +38,7 @@ pub trait Factor: Any + Sized {
38
38
/// This method is given access to the app component being instantiated and
39
39
/// to any other factors' instance builders that have already been prepared.
40
40
fn prepare < T : RuntimeFactors > (
41
+ & self ,
41
42
ctx : PrepareContext < Self > ,
42
43
_builders : & mut InstanceBuilders < T > ,
43
44
) -> anyhow:: Result < Self :: InstanceBuilder > ;
Original file line number Diff line number Diff line change @@ -32,25 +32,19 @@ impl<T: SelfInstanceBuilder> FactorInstanceBuilder for T {
32
32
/// already-initialized [`FactorInstanceBuilder`]s, allowing for
33
33
/// inter-[`Factor`] dependencies.
34
34
pub struct PrepareContext < ' a , F : Factor > {
35
- pub ( crate ) factor : & ' a F ,
36
35
pub ( crate ) app_state : & ' a F :: AppState ,
37
36
pub ( crate ) app_component : & ' a AppComponent < ' a > ,
38
37
}
39
38
40
39
impl < ' a , F : Factor > PrepareContext < ' a , F > {
41
40
#[ doc( hidden) ]
42
- pub fn new ( factor : & ' a F , app_state : & ' a F :: AppState , app_component : & ' a AppComponent ) -> Self {
41
+ pub fn new ( app_state : & ' a F :: AppState , app_component : & ' a AppComponent ) -> Self {
43
42
Self {
44
- factor,
45
43
app_state,
46
44
app_component,
47
45
}
48
46
}
49
47
50
- pub fn factor ( & self ) -> & F {
51
- self . factor
52
- }
53
-
54
48
pub fn app_state ( & self ) -> & F :: AppState {
55
49
self . app_state
56
50
}
You can’t perform that action at this time.
0 commit comments