1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
//!
//! Alias module for using `Rc` to wrap `Blueprint` and artifacts.
//!
use Debug;
use Any;
use cfg_if;
use crateDoctor;
use crateBlueprintDyn;
use crateNever;
/// Type for wrapping a `T` as part of `CanType` as `Can`.
///
/// This is just an alias for `Arc<T>`.
///
pub type BinType<T> = Arc;
/// Can for wrappers of this module.
///
/// This is just an alias for `Arc<dyn Any + Send + Sync>`.
///
pub type CanType = ;
/// The wrapping type for builders.
///
/// Here it is the same as `BinType`.
///
pub type BuilderBinType<T> = ;
/// The can type for builders.
///
pub type BuilderCan = CanType;
/// Wraps a Builder as a blueprint for its artifact from the `Cache`.
///
pub type Blueprint<B> = crateBlueprint;
cfg_if!
/// An `Blueprint` with a `dyn Builder<Artifact=Artifact>`.
pub type DynamicBlueprint<Artifact, Err=Never, DynState=> =
;
pub type ConstBuilder<T> = crateConstBuilder;
pub type ConfigurableBuilder<T> = crateConfigurableBuilder;
/// Allows to resolve any `Blueprint` into its artifact. Usable within a
/// builders `build` function.
///
/// This resolver uses `Arc` for storing builders and artifacts.
///
pub type Resolver<'a, T = > = crateResolver;
/*
/// Allows to resolve any `Blueprint` into its artifact-builder. Usable
/// within a super-builders `build` function.
///
/// This resolver uses `Arc` for storing builders and `Blueprint` for
/// storing artifacts, i.e. the artifacts are builders them self.
///
pub type SuperResolver<'a, T = ()> = crate::Resolver<'a, BuilderArtifact<CanType>, CanType, T>;
*/
cfg_if!
/// The ownable and storable variant of the Cache.
///
pub type CacheOwned = crateCacheOwned;
/*
/// Allows to resolve any `Blueprint` into its artifact-builder.
///
/// This cache uses `Arc` for storing builders and `Blueprint` for
/// storing artifacts, i.e. the artifacts are builders them self.
///
#[cfg(not(feature = "diagnostics"))]
pub type SuperCache = crate::Cache<BuilderArtifact<CanType>, CanType>;
/// Allows to resolve any `Blueprint` into its artifact-builder.
///
/// This cache uses `Arc` for storing builders and `Blueprint` for
/// storing artifacts, i.e. the artifacts are builders them self.
///
#[cfg(feature = "diagnostics")]
pub type SuperCache<T = dyn Doctor<BuilderArtifact<CanType>, CanType>> = crate::Cache<BuilderArtifact<CanType>, CanType, T>;
*/
/// Functional builder wrapper.
///
pub type FunctionalBuilder<F, S = > =
crateFunctionalBuilder;
/// A simplified builder interface, intended for implementing builders.
///
/// For this trait exists a generic `impl Builder`.
///
// Generic impl for legacy builder
/// A Builder using `Arc` for `Blueprint` and artifacts.
///
/*
/// A builder of builders using `Arc`s.
///
/// This cache uses `Arc` for storing builders and `Blueprint` for
/// storing artifacts, i.e. the artifacts are builders them self.
///
pub trait SuperBuilder: Debug + Send + Sync + 'static {
/// The artifact type as produced by this builder. It is supposed to be
/// another `Builder` (or `SuperBuilder`).
///
type Artifact : Debug + Send + Sync + 'static;
/// Type of the dynamic state of this builder.
///
type DynState : Debug + 'static;
/// Error type returned by this Builder in case of failure to produce an
/// Artifact.
type Err : Debug + 'static;
/// Produces an artifact using the given `Resolver` for resolving
/// dependencies.
///
fn build(&self, resolver: &mut SuperResolver<Self::DynState>)
-> Result<Self::Artifact, Self::Err>;
/// Return an inital dynamic state for this builder.
///
fn init_dyn_state(&self) -> Self::DynState;
}
impl<B: ?Sized + SuperBuilder> crate::Builder<BuilderArtifact<CanType>, CanType> for B {
type Artifact = B::Artifact;
type DynState = B::DynState;
type Err = B::Err;
fn build(&self, cache: &mut SuperResolver<Self::DynState>)
-> Result<Self::Artifact, Self::Err> {
self.build(cache)
}
fn init_dyn_state(&self) -> Self::DynState {
self.init_dyn_state()
}
}
*/