|
25 | 25 | //! // Passive extension, fresh-per-consumer policy. |
26 | 26 | //! builder |
27 | 27 | //! .passive() |
28 | | -//! .factory() |
| 28 | +//! .fresh() |
29 | 29 | //! .shared(|| MyShared::new(cfg.clone())) |
30 | 30 | //! .local(|| Rc::new(MyLocal::new(cfg.clone()))) |
31 | 31 | //! .build()?; |
|
36 | 36 | //! | Axis | Methods | |
37 | 37 | //! |-----------------|----------------------------------------------------------------------------| |
38 | 38 | //! | Lifecycle | `.active()` / `.passive()` | |
39 | | -//! | Instance policy | *(implicit Cloned for Active)* `.cloned()` / `.factory()` *(Passive only)* | |
| 39 | +//! | Instance policy | *(implicit Cloned for Active)* `.cloned()` / `.fresh()` *(Passive only)* | |
40 | 40 | //! | Side | `.shared(...)` / `.local(...)` *(repeatable, register once each)* | |
41 | 41 | //! |
42 | 42 | //! **Why the lifecycle and policy are sealed per bundle.** "This |
|
50 | 50 | //! strategy across both sides makes the extension's behavior |
51 | 51 | //! predictable and eliminates a combinatorial footgun. |
52 | 52 | //! |
53 | | -//! **Active + Factory is unrepresentable.** Active extensions have a |
| 53 | +//! **Active + Fresh is unrepresentable.** Active extensions have a |
54 | 54 | //! single engine-driven event loop; minting fresh instances per |
55 | 55 | //! consumer doesn't compose with that. The `.active()` stage provides |
56 | | -//! no `.factory()` method — the invalid combination is a compile-time |
| 56 | +//! no `.fresh()` method — the invalid combination is a compile-time |
57 | 57 | //! error. |
58 | 58 |
|
59 | 59 | use super::{ExtensionBundle, ExtensionLifecycle, ExtensionWrapper}; |
@@ -176,8 +176,8 @@ impl PassiveStage { |
176 | 176 | /// Select the **fresh-per-consumer** instance policy: each consumer |
177 | 177 | /// receives a freshly-constructed instance from the stored closure. |
178 | 178 | #[must_use] |
179 | | - pub fn factory(self) -> PassiveFactoryStage { |
180 | | - PassiveFactoryStage { |
| 179 | + pub fn fresh(self) -> PassiveFreshStage { |
| 180 | + PassiveFreshStage { |
181 | 181 | parent: self.parent, |
182 | 182 | } |
183 | 183 | } |
@@ -234,13 +234,13 @@ impl PassiveClonedStage { |
234 | 234 | } |
235 | 235 | } |
236 | 236 |
|
237 | | -/// Passive + Factory (fresh-per-consumer) stage. |
| 237 | +/// Passive + Fresh (fresh-per-consumer) stage. |
238 | 238 | #[doc(hidden)] |
239 | | -pub struct PassiveFactoryStage { |
| 239 | +pub struct PassiveFreshStage { |
240 | 240 | parent: ExtensionBundleBuilder, |
241 | 241 | } |
242 | 242 |
|
243 | | -impl PassiveFactoryStage { |
| 243 | +impl PassiveFreshStage { |
244 | 244 | /// Register the shared (Send) variant via a factory closure. |
245 | 245 | /// Each consumer receives a freshly-constructed instance. |
246 | 246 | /// |
@@ -337,7 +337,7 @@ impl ExtensionBundleBuilder { |
337 | 337 | /// event loop is spawned; the extension exposes capabilities only. |
338 | 338 | /// |
339 | 339 | /// Continue with [`PassiveStage::cloned`] (clone-per-consumer) |
340 | | - /// or [`PassiveStage::factory`] (fresh-per-consumer). |
| 340 | + /// or [`PassiveStage::fresh`] (fresh-per-consumer). |
341 | 341 | #[must_use] |
342 | 342 | pub fn passive(self) -> PassiveStage { |
343 | 343 | PassiveStage { parent: self } |
|
0 commit comments