Skip to main content

typestate_pipeline/
lib.rs

1#![cfg_attr(docsrs, feature(doc_cfg, doc_notable_trait))]
2#![doc = include_str!("../README.md")]
3//!
4//! ---
5//!
6//! ### Implementation note
7//!
8//! Both proc-macros emit fully-qualified paths through this crate's
9//! [`__private`] module as `::typestate_pipeline::__private::*`. The
10//! `extern crate self as typestate_pipeline;` declaration below makes
11//! that absolute path resolve from in-package uses (lib src, integration
12//! tests, examples) as well as from downstream consumers. Renamed deps
13//! (`helpers = { package = "typestate-pipeline" }`) are detected via
14//! `proc_macro_crate` and routed through `::helpers::*`.
15
16extern crate self as typestate_pipeline;
17
18#[doc(inline)]
19pub use typestate_pipeline_core::{
20    BoxFuture, InFlight, Mode, No, Pipeline, Pipelined, Resolved, Satisfiable, Satisfied, Storage,
21    Yes,
22};
23#[doc(inline)]
24pub use typestate_pipeline_macros::{TypestateFactory, transitions};
25
26/// Implementation detail. Items referenced by macro expansions.
27///
28/// Not part of the public API.
29#[doc(hidden)]
30pub mod __private {
31    pub use core::marker::PhantomData;
32    pub use core::mem::{ManuallyDrop, MaybeUninit};
33    pub use core::pin::Pin;
34    pub use core::ptr;
35    pub use std::boxed::Box;
36
37    pub use typestate_pipeline_core::{
38        BoxFuture, InFlight, Mode, No, Pipeline, Pipelined, Resolved, Satisfiable, Satisfied,
39        Storage, Yes,
40    };
41}
42
43#[doc(hidden)]
44#[cfg(feature = "dataset-authoring-example")]
45#[cfg_attr(docsrs, doc(cfg(feature = "dataset-authoring-example")))]
46pub mod dataset_authoring;
47
48/// One continuous narrative covering every macro the crate
49/// offers — the factory first, then `#[transitions]`, then the
50/// carrier macros (`pipelined!` / `impl_pipelined!`), then the
51/// combinations. Each section pairs runnable source (the same
52/// files the [test suite] compiles) with a sketch of the
53/// generated surface, so you can read what the macros emit
54/// without running `cargo expand`.
55///
56/// Only present in rustdoc builds — `guide` is not an
57/// importable path in downstream crates.
58///
59/// [test suite]: https://github.com/JohnSwan1503/typestate-pipeline/tree/main/crates/typestate-pipeline/tests/expansions
60#[cfg(any(doc, docsrs))]
61pub mod guide {
62    #![doc = include_str!("../examples/expansions/lead.md")]
63    //!
64    #![doc = include_str!("../examples/expansions/factory/intro.md")]
65    //!
66    #![doc = include_str!("../examples/expansions/factory/minimal.description.md")]
67    //!
68    //! ```rust
69    #![doc = include_str!("../examples/expansions/factory/minimal.rs")]
70    //! ```
71    //!
72    //! **Generated (sketch):**
73    //!
74    #![doc = include_str!("../examples/expansions/factory/minimal.expansion.md")]
75    //!
76    #![doc = include_str!("../examples/expansions/factory/required_and_optional.description.md")]
77    //!
78    //! ```rust
79    #![doc = include_str!("../examples/expansions/factory/required_and_optional.rs")]
80    //! ```
81    //!
82    //! **Generated (sketch):**
83    //!
84    #![doc = include_str!("../examples/expansions/factory/required_and_optional.expansion.md")]
85    //!
86    #![doc = include_str!("../examples/expansions/factory/default.description.md")]
87    //!
88    //! ```rust
89    #![doc = include_str!("../examples/expansions/factory/default.rs")]
90    //! ```
91    //!
92    //! **Generated (sketch):**
93    //!
94    #![doc = include_str!("../examples/expansions/factory/default.expansion.md")]
95    //!
96    #![doc = include_str!("../examples/expansions/factory/removable.description.md")]
97    //!
98    //! ```rust
99    #![doc = include_str!("../examples/expansions/factory/removable.rs")]
100    //! ```
101    //!
102    //! **Generated (sketch):**
103    //!
104    #![doc = include_str!("../examples/expansions/factory/removable.expansion.md")]
105    //!
106    #![doc = include_str!("../examples/expansions/factory/overridable.description.md")]
107    //!
108    //! ```rust
109    #![doc = include_str!("../examples/expansions/factory/overridable.rs")]
110    //! ```
111    //!
112    //! **Generated (sketch):**
113    //!
114    #![doc = include_str!("../examples/expansions/factory/overridable.expansion.md")]
115    //!
116    #![doc = include_str!("../examples/expansions/factory/rename.description.md")]
117    //!
118    //! ```rust
119    #![doc = include_str!("../examples/expansions/factory/rename.rs")]
120    //! ```
121    //!
122    //! **Generated (sketch):**
123    //!
124    #![doc = include_str!("../examples/expansions/factory/rename.expansion.md")]
125    //!
126    #![doc = include_str!("../examples/expansions/factory/setter_transformer.description.md")]
127    //!
128    //! ```rust
129    #![doc = include_str!("../examples/expansions/factory/setter_transformer.rs")]
130    //! ```
131    //!
132    //! **Generated (sketch):**
133    //!
134    #![doc = include_str!("../examples/expansions/factory/setter_transformer.expansion.md")]
135    //!
136    #![doc = include_str!("../examples/expansions/factory/setter_input_type.description.md")]
137    //!
138    //! ```rust
139    #![doc = include_str!("../examples/expansions/factory/setter_input_type.rs")]
140    //! ```
141    //!
142    //! **Generated (sketch):**
143    //!
144    #![doc = include_str!("../examples/expansions/factory/setter_input_type.expansion.md")]
145    //!
146    #![doc = include_str!("../examples/expansions/factory/setter_fallible.description.md")]
147    //!
148    //! ```rust
149    #![doc = include_str!("../examples/expansions/factory/setter_fallible.rs")]
150    //! ```
151    //!
152    //! **Generated (sketch):**
153    //!
154    #![doc = include_str!("../examples/expansions/factory/setter_fallible.expansion.md")]
155    //!
156    #![doc = include_str!("../examples/expansions/factory/setter_async.description.md")]
157    //!
158    //! ```rust
159    #![doc = include_str!("../examples/expansions/factory/setter_async.rs")]
160    //! ```
161    //!
162    //! **Generated (sketch):**
163    //!
164    #![doc = include_str!("../examples/expansions/factory/setter_async.expansion.md")]
165    //!
166    #![doc = include_str!("../examples/expansions/factory/internal.description.md")]
167    //!
168    //! ```rust
169    #![doc = include_str!("../examples/expansions/factory/internal.rs")]
170    //! ```
171    //!
172    //! **Generated (sketch):**
173    //!
174    #![doc = include_str!("../examples/expansions/factory/internal.expansion.md")]
175    //!
176    #![doc = include_str!("../examples/expansions/factory/finalize_async.description.md")]
177    //!
178    //! ```rust
179    #![doc = include_str!("../examples/expansions/factory/finalize_async.rs")]
180    //! ```
181    //!
182    //! **Generated (sketch):**
183    //!
184    #![doc = include_str!("../examples/expansions/factory/finalize_async.expansion.md")]
185    //!
186    #![doc = include_str!("../examples/expansions/factory/ready_trait.description.md")]
187    //!
188    //! ```rust
189    #![doc = include_str!("../examples/expansions/factory/ready_trait.rs")]
190    //! ```
191    //!
192    //! **Generated (sketch):**
193    //!
194    #![doc = include_str!("../examples/expansions/factory/ready_trait.expansion.md")]
195    //!
196    #![doc = include_str!("../examples/expansions/factory/empty_alias.description.md")]
197    //!
198    //! ```rust
199    #![doc = include_str!("../examples/expansions/factory/empty_alias.rs")]
200    //! ```
201    //!
202    //! **Generated (sketch):**
203    //!
204    #![doc = include_str!("../examples/expansions/factory/empty_alias.expansion.md")]
205    //!
206    #![doc = include_str!("../examples/expansions/factory/pipeline_arm.description.md")]
207    //!
208    //! ```rust
209    #![doc = include_str!("../examples/expansions/factory/pipeline_arm.rs")]
210    //! ```
211    //!
212    //! **Generated (sketch):**
213    //!
214    #![doc = include_str!("../examples/expansions/factory/pipeline_arm.expansion.md")]
215    //!
216    #![doc = include_str!("../examples/expansions/factory/no_unsafe.description.md")]
217    //!
218    //! ```rust
219    #![doc = include_str!("../examples/expansions/factory/no_unsafe.rs")]
220    //! ```
221    //!
222    //! **Generated (sketch):**
223    //!
224    #![doc = include_str!("../examples/expansions/factory/no_unsafe.expansion.md")]
225    //!
226    #![doc = include_str!("../examples/expansions/transitions/intro.md")]
227    //!
228    #![doc = include_str!("../examples/expansions/transitions/sync_infallible.description.md")]
229    //!
230    //! ```rust
231    #![doc = include_str!("../examples/expansions/transitions/sync_infallible.rs")]
232    //! ```
233    //!
234    //! **Generated (sketch):**
235    //!
236    #![doc = include_str!("../examples/expansions/transitions/sync_infallible.expansion.md")]
237    //!
238    #![doc = include_str!("../examples/expansions/transitions/sync_fallible.description.md")]
239    //!
240    //! ```rust
241    #![doc = include_str!("../examples/expansions/transitions/sync_fallible.rs")]
242    //! ```
243    //!
244    //! **Generated (sketch):**
245    //!
246    #![doc = include_str!("../examples/expansions/transitions/sync_fallible.expansion.md")]
247    //!
248    #![doc = include_str!("../examples/expansions/transitions/async_deferred.description.md")]
249    //!
250    //! ```rust
251    #![doc = include_str!("../examples/expansions/transitions/async_deferred.rs")]
252    //! ```
253    //!
254    //! **Generated (sketch):**
255    //!
256    #![doc = include_str!("../examples/expansions/transitions/async_deferred.expansion.md")]
257    //!
258    #![doc = include_str!("../examples/expansions/transitions/async_breakpoint.description.md")]
259    //!
260    //! ```rust
261    #![doc = include_str!("../examples/expansions/transitions/async_breakpoint.rs")]
262    //! ```
263    //!
264    //! **Generated (sketch):**
265    //!
266    #![doc = include_str!("../examples/expansions/transitions/async_breakpoint.expansion.md")]
267    //!
268    #![doc = include_str!("../examples/expansions/pipelined/intro.md")]
269    //!
270    #![doc = include_str!("../examples/expansions/pipelined/minimal.description.md")]
271    //!
272    //! ```rust
273    #![doc = include_str!("../examples/expansions/pipelined/minimal.rs")]
274    //! ```
275    //!
276    //! **Generated (sketch):**
277    //!
278    #![doc = include_str!("../examples/expansions/pipelined/minimal.expansion.md")]
279    //!
280    #![doc = include_str!("../examples/expansions/pipelined/inspect_combinator.description.md")]
281    //!
282    //! ```rust
283    #![doc = include_str!("../examples/expansions/pipelined/inspect_combinator.rs")]
284    //! ```
285    //!
286    //! **Generated (sketch):**
287    //!
288    #![doc = include_str!("../examples/expansions/pipelined/inspect_combinator.expansion.md")]
289    //!
290    #![doc = include_str!("../examples/expansions/pipelined/with_tag.description.md")]
291    //!
292    //! ```rust
293    #![doc = include_str!("../examples/expansions/pipelined/with_tag.rs")]
294    //! ```
295    //!
296    //! **Generated (sketch):**
297    //!
298    #![doc = include_str!("../examples/expansions/pipelined/with_tag.expansion.md")]
299    //!
300    #![doc = include_str!("../examples/expansions/impl_pipelined/intro.md")]
301    //!
302    #![doc = include_str!("../examples/expansions/impl_pipelined/minimal.description.md")]
303    //!
304    //! ```rust
305    #![doc = include_str!("../examples/expansions/impl_pipelined/minimal.rs")]
306    //! ```
307    //!
308    //! **Generated (sketch):**
309    //!
310    #![doc = include_str!("../examples/expansions/impl_pipelined/minimal.expansion.md")]
311    //!
312    #![doc = include_str!("../examples/expansions/combo/intro.md")]
313    //!
314    #![doc = include_str!("../examples/expansions/combo/factory_in_pipeline.description.md")]
315    //!
316    //! ```rust
317    #![doc = include_str!("../examples/expansions/combo/factory_in_pipeline.rs")]
318    //! ```
319}
320
321/// The integration test catalog — every test file rendered as a
322/// browsable page so you can see exactly what behavior is locked in.
323///
324/// Tests are grouped by domain. UI tests pair the trybuild source with
325/// the pinned `.stderr` snapshot so you can see the exact diagnostic
326/// users get for each kind of misuse.
327///
328/// Only present in rustdoc builds — `tests` is not an importable path
329/// in downstream crates.
330#[cfg(any(doc, docsrs))]
331pub mod tests {
332    /// `#[derive(TypestateFactory)]` feature coverage.
333    pub mod factory {
334        /// Construction & getters, Drop semantics, removable/overridable,
335        /// defaults & conditional finalize, custom names, and sync
336        /// transformers (infallible + fallible).
337        ///
338        #[doc = include_str!("../tests/factory/core/docs/tests.md")]
339        ///
340        /// ## Test Cases
341        ///
342        #[doc = include_str!("../tests/factory/core/docs/build_in_order.md")]
343        ///
344        /// ```rust
345        #[doc = include_str!("../tests/factory/core/tests/build_in_order.rs")]
346        /// ```
347        ///
348        #[doc = include_str!("../tests/factory/core/docs/build_in_arbitrary_order.md")]
349        ///
350        /// ```rust
351        #[doc = include_str!("../tests/factory/core/tests/build_in_arbitrary_order.rs")]
352        /// ```
353        ///
354        #[doc = include_str!("../tests/factory/core/docs/default_helper_fills_in_optional.md")]
355        ///
356        /// ```rust
357        #[doc = include_str!("../tests/factory/core/tests/default_helper_fills_in_optional.rs")]
358        /// ```
359        ///
360        #[doc = include_str!("../tests/factory/core/docs/getter_borrows_set_field.md")]
361        ///
362        /// ```rust
363        #[doc = include_str!("../tests/factory/core/tests/getter_borrows_set_field.rs")]
364        /// ```
365        ///
366        #[doc = include_str!("../tests/factory/core/docs/empty_bag_dropped_does_not_touch_uninit_fields.md")]
367        ///
368        /// ```rust
369        #[doc = include_str!("../tests/factory/core/tests/empty_bag_dropped_does_not_touch_uninit_fields.rs")]
370        /// ```
371        ///
372        #[doc = include_str!("../tests/factory/core/docs/partial_bag_dropped_drops_only_set_fields.md")]
373        ///
374        /// ```rust
375        #[doc = include_str!("../tests/factory/core/tests/partial_bag_dropped_drops_only_set_fields.rs")]
376        /// ```
377        ///
378        #[doc = include_str!("../tests/factory/core/docs/fully_populated_bag_dropped_drops_all.md")]
379        ///
380        /// ```rust
381        #[doc = include_str!("../tests/factory/core/tests/fully_populated_bag_dropped_drops_all.rs")]
382        /// ```
383        ///
384        #[doc = include_str!("../tests/factory/core/docs/finalize_does_not_double_drop.md")]
385        ///
386        /// ```rust
387        #[doc = include_str!("../tests/factory/core/tests/finalize_does_not_double_drop.rs")]
388        /// ```
389        ///
390        #[doc = include_str!("../tests/factory/core/docs/drop_field_drops_value_once.md")]
391        ///
392        /// ```rust
393        #[doc = include_str!("../tests/factory/core/tests/drop_field_drops_value_once.rs")]
394        /// ```
395        ///
396        #[doc = include_str!("../tests/factory/core/docs/drop_field_then_reset_doesnt_double_drop.md")]
397        ///
398        /// ```rust
399        #[doc = include_str!("../tests/factory/core/tests/drop_field_then_reset_doesnt_double_drop.rs")]
400        /// ```
401        ///
402        #[doc = include_str!("../tests/factory/core/docs/override_drops_old_value.md")]
403        ///
404        /// ```rust
405        #[doc = include_str!("../tests/factory/core/tests/override_drops_old_value.rs")]
406        /// ```
407        ///
408        #[doc = include_str!("../tests/factory/core/docs/finalize_uses_defaults_when_optional_no.md")]
409        ///
410        /// ```rust
411        #[doc = include_str!("../tests/factory/core/tests/finalize_uses_defaults_when_optional_no.rs")]
412        /// ```
413        ///
414        #[doc = include_str!("../tests/factory/core/docs/finalize_keeps_explicit_values_when_optional_yes.md")]
415        ///
416        /// ```rust
417        #[doc = include_str!("../tests/factory/core/tests/finalize_keeps_explicit_values_when_optional_yes.rs")]
418        /// ```
419        ///
420        #[doc = include_str!("../tests/factory/core/docs/finalize_mixes_set_and_default.md")]
421        ///
422        /// ```rust
423        #[doc = include_str!("../tests/factory/core/tests/finalize_mixes_set_and_default.rs")]
424        /// ```
425        ///
426        #[doc = include_str!("../tests/factory/core/docs/custom_bag_name.md")]
427        ///
428        /// ```rust
429        #[doc = include_str!("../tests/factory/core/tests/custom_bag_name.rs")]
430        /// ```
431        ///
432        #[doc = include_str!("../tests/factory/core/docs/custom_setter_name.md")]
433        ///
434        /// ```rust
435        #[doc = include_str!("../tests/factory/core/tests/custom_setter_name.rs")]
436        /// ```
437        ///
438        #[doc = include_str!("../tests/factory/core/docs/custom_transformer_fn.md")]
439        ///
440        /// ```rust
441        #[doc = include_str!("../tests/factory/core/tests/custom_transformer_fn.rs")]
442        /// ```
443        ///
444        #[doc = include_str!("../tests/factory/core/docs/fallible_transformer_success.md")]
445        ///
446        /// ```rust
447        #[doc = include_str!("../tests/factory/core/tests/fallible_transformer_success.rs")]
448        /// ```
449        ///
450        #[doc = include_str!("../tests/factory/core/docs/fallible_transformer_failure.md")]
451        ///
452        /// ```rust
453        #[doc = include_str!("../tests/factory/core/tests/fallible_transformer_failure.rs")]
454        /// ```
455        ///
456        /// ## Shared types and setup
457        ///
458        #[doc = include_str!("../tests/factory/core/docs/shared.md")]
459        ///
460        /// ```rust
461        #[doc = include_str!("../tests/factory/core/tests/shared.rs")]
462        /// ```
463        pub mod core {}
464
465        /// `async_fn` setters (success and failure), `finalize_async`,
466        /// pipeline-arm async setters threading through `InFlight`, and
467        /// `#[transitions]` bodies that call `.finalize()` mid-chain.
468        ///
469        #[doc = include_str!("../tests/factory/async/docs/tests.md")]
470        ///
471        /// ## Test Cases
472        ///
473        #[doc = include_str!("../tests/factory/async/docs/standalone_async_setter_non_fallible.md")]
474        ///
475        /// ```rust
476        #[doc = include_str!("../tests/factory/async/tests/standalone_async_setter_non_fallible.rs")]
477        /// ```
478        ///
479        #[doc = include_str!("../tests/factory/async/docs/standalone_async_setter_fallible_failure.md")]
480        ///
481        /// ```rust
482        #[doc = include_str!("../tests/factory/async/tests/standalone_async_setter_fallible_failure.rs")]
483        /// ```
484        ///
485        #[doc = include_str!("../tests/factory/async/docs/standalone_async_finalize.md")]
486        ///
487        /// ```rust
488        #[doc = include_str!("../tests/factory/async/tests/standalone_async_finalize.rs")]
489        /// ```
490        ///
491        #[doc = include_str!("../tests/factory/async/docs/pipeline_async_setter_chains_through_inflight.md")]
492        ///
493        /// ```rust
494        #[doc = include_str!("../tests/factory/async/tests/pipeline_async_setter_chains_through_inflight.rs")]
495        /// ```
496        ///
497        #[doc = include_str!("../tests/factory/async/docs/pipeline_async_fallible_setter_propagates_error.md")]
498        ///
499        /// ```rust
500        #[doc = include_str!("../tests/factory/async/tests/pipeline_async_fallible_setter_propagates_error.rs")]
501        /// ```
502        ///
503        #[doc = include_str!("../tests/factory/async/docs/transitions_body_calls_finalize.md")]
504        ///
505        /// ```rust
506        #[doc = include_str!("../tests/factory/async/tests/transitions_body_calls_finalize.rs")]
507        /// ```
508        ///
509        /// ## Shared types and setup
510        ///
511        #[doc = include_str!("../tests/factory/async/docs/error.md")]
512        ///
513        /// ```rust
514        #[doc = include_str!("../tests/factory/async/tests/error.rs")]
515        /// ```
516        ///
517        #[doc = include_str!("../tests/factory/async/docs/bags.md")]
518        ///
519        /// ```rust
520        #[doc = include_str!("../tests/factory/async/tests/bags.rs")]
521        /// ```
522        ///
523        #[doc = include_str!("../tests/factory/async/docs/carrier.md")]
524        ///
525        /// ```rust
526        #[doc = include_str!("../tests/factory/async/tests/carrier.rs")]
527        /// ```
528        pub mod async_setters {}
529
530        /// `input = …` setter input types and how they bridge to the
531        /// storage type via the transformer.
532        ///
533        #[doc = include_str!("../tests/factory/input_type/docs/tests.md")]
534        ///
535        /// ## Test Cases
536        ///
537        #[doc = include_str!("../tests/factory/input_type/docs/setter_takes_input_type_not_field_type.md")]
538        ///
539        /// ```rust
540        #[doc = include_str!("../tests/factory/input_type/tests/setter_takes_input_type_not_field_type.rs")]
541        /// ```
542        ///
543        #[doc = include_str!("../tests/factory/input_type/docs/default_helper_bypasses_transformer.md")]
544        ///
545        /// ```rust
546        #[doc = include_str!("../tests/factory/input_type/tests/default_helper_bypasses_transformer.rs")]
547        /// ```
548        ///
549        #[doc = include_str!("../tests/factory/input_type/docs/unset_default_field_uses_default_at_finalize.md")]
550        ///
551        /// ```rust
552        #[doc = include_str!("../tests/factory/input_type/tests/unset_default_field_uses_default_at_finalize.rs")]
553        /// ```
554        ///
555        /// ## Shared types and setup
556        ///
557        #[doc = include_str!("../tests/factory/input_type/docs/shared.md")]
558        ///
559        /// ```rust
560        #[doc = include_str!("../tests/factory/input_type/tests/shared.rs")]
561        /// ```
562        pub mod input_type {}
563
564        /// `internal` field positional-on-`new`, dropped from the
565        /// flag-generic list, with unconditional getters on both bag
566        /// and carrier arms.
567        ///
568        #[doc = include_str!("../tests/factory/internal_field/docs/tests.md")]
569        ///
570        /// ## Test Cases
571        ///
572        #[doc = include_str!("../tests/factory/internal_field/docs/constructor_takes_internal_field_as_argument.md")]
573        ///
574        /// ```rust
575        #[doc = include_str!("../tests/factory/internal_field/tests/constructor_takes_internal_field_as_argument.rs")]
576        /// ```
577        ///
578        #[doc = include_str!("../tests/factory/internal_field/docs/internal_getter_is_unconditional.md")]
579        ///
580        /// ```rust
581        #[doc = include_str!("../tests/factory/internal_field/tests/internal_getter_is_unconditional.rs")]
582        /// ```
583        ///
584        #[doc = include_str!("../tests/factory/internal_field/docs/internal_field_dropped_from_flag_generic_list.md")]
585        ///
586        /// ```rust
587        #[doc = include_str!("../tests/factory/internal_field/tests/internal_field_dropped_from_flag_generic_list.rs")]
588        /// ```
589        ///
590        #[doc = include_str!("../tests/factory/internal_field/docs/pipeline_arm_works_for_non_internal_fields.md")]
591        ///
592        /// ```rust
593        #[doc = include_str!("../tests/factory/internal_field/tests/pipeline_arm_works_for_non_internal_fields.rs")]
594        /// ```
595        ///
596        #[doc = include_str!("../tests/factory/internal_field/docs/finalize_passes_internal_field_through.md")]
597        ///
598        /// ```rust
599        #[doc = include_str!("../tests/factory/internal_field/tests/finalize_passes_internal_field_through.rs")]
600        /// ```
601        ///
602        #[doc = include_str!("../tests/factory/internal_field/docs/carrier_internal_getter_is_unconditional.md")]
603        ///
604        /// ```rust
605        #[doc = include_str!("../tests/factory/internal_field/tests/carrier_internal_getter_is_unconditional.rs")]
606        /// ```
607        ///
608        #[doc = include_str!("../tests/factory/internal_field/docs/carrier_non_internal_getter_gates_on_yes_flag.md")]
609        ///
610        /// ```rust
611        #[doc = include_str!("../tests/factory/internal_field/tests/carrier_non_internal_getter_gates_on_yes_flag.rs")]
612        /// ```
613        ///
614        /// ## Shared types and setup
615        ///
616        #[doc = include_str!("../tests/factory/internal_field/docs/error.md")]
617        ///
618        /// ```rust
619        #[doc = include_str!("../tests/factory/internal_field/tests/error.rs")]
620        /// ```
621        ///
622        #[doc = include_str!("../tests/factory/internal_field/docs/carrier.md")]
623        ///
624        /// ```rust
625        #[doc = include_str!("../tests/factory/internal_field/tests/carrier.rs")]
626        /// ```
627        pub mod internal_field {}
628
629        /// `<Bag>Ready` companion trait — auto-impl matches `finalize`'s
630        /// bounds; generic `B: <Bag>Ready` dispatch matches inherent
631        /// `finalize()`.
632        ///
633        #[doc = include_str!("../tests/factory/ready_trait/docs/tests.md")]
634        ///
635        /// ## Test Cases
636        ///
637        #[doc = include_str!("../tests/factory/ready_trait/docs/ready_trait_is_implemented_when_required_flags_yes.md")]
638        ///
639        /// ```rust
640        #[doc = include_str!("../tests/factory/ready_trait/tests/ready_trait_is_implemented_when_required_flags_yes.rs")]
641        /// ```
642        ///
643        #[doc = include_str!("../tests/factory/ready_trait/docs/ready_trait_works_when_optional_set_too.md")]
644        ///
645        /// ```rust
646        #[doc = include_str!("../tests/factory/ready_trait/tests/ready_trait_works_when_optional_set_too.rs")]
647        /// ```
648        ///
649        #[doc = include_str!("../tests/factory/ready_trait/docs/dispatch_via_trait_matches_inherent_finalize.md")]
650        ///
651        /// ```rust
652        #[doc = include_str!("../tests/factory/ready_trait/tests/dispatch_via_trait_matches_inherent_finalize.rs")]
653        /// ```
654        ///
655        /// ## Shared types and setup
656        ///
657        #[doc = include_str!("../tests/factory/ready_trait/docs/shared.md")]
658        ///
659        /// ```rust
660        #[doc = include_str!("../tests/factory/ready_trait/tests/shared.rs")]
661        /// ```
662        pub mod ready_trait {}
663    }
664
665    /// `#[transitions]` body shapes and `Pipelined` resolution.
666    pub mod transitions {
667        /// Full Resolved → InFlight → Resolved chain folding,
668        /// breakpoint `breakpoint` forcing explicit awaits, sync
669        /// fallible arms, `IntoFuture` driving InFlight back to
670        /// Resolved.
671        ///
672        #[doc = include_str!("../tests/transitions/core/docs/tests.md")]
673        ///
674        /// ## Test Cases
675        ///
676        #[doc = include_str!("../tests/transitions/core/docs/full_chain_with_resolved_breakpoint_in_middle.md")]
677        ///
678        /// ```rust
679        #[doc = include_str!("../tests/transitions/core/tests/full_chain_with_resolved_breakpoint_in_middle.rs")]
680        /// ```
681        ///
682        #[doc = include_str!("../tests/transitions/core/docs/breakpoint_forces_explicit_await.md")]
683        ///
684        /// ```rust
685        #[doc = include_str!("../tests/transitions/core/tests/breakpoint_forces_explicit_await.rs")]
686        /// ```
687        ///
688        #[doc = include_str!("../tests/transitions/core/docs/sync_fallible_resolved_returns_result_directly.md")]
689        ///
690        /// ```rust
691        #[doc = include_str!("../tests/transitions/core/tests/sync_fallible_resolved_returns_result_directly.rs")]
692        /// ```
693        ///
694        #[doc = include_str!("../tests/transitions/core/docs/sync_fallible_propagates_through_inflight_chain.md")]
695        ///
696        /// ```rust
697        #[doc = include_str!("../tests/transitions/core/tests/sync_fallible_propagates_through_inflight_chain.rs")]
698        /// ```
699        ///
700        #[doc = include_str!("../tests/transitions/core/docs/intofuture_resolves_inflight_back_to_resolved.md")]
701        ///
702        /// ```rust
703        #[doc = include_str!("../tests/transitions/core/tests/intofuture_resolves_inflight_back_to_resolved.rs")]
704        /// ```
705        ///
706        /// ## Shared types and setup
707        ///
708        #[doc = include_str!("../tests/transitions/core/docs/error.md")]
709        ///
710        /// ```rust
711        #[doc = include_str!("../tests/transitions/core/tests/error.rs")]
712        /// ```
713        ///
714        #[doc = include_str!("../tests/transitions/core/docs/phases.md")]
715        ///
716        /// ```rust
717        #[doc = include_str!("../tests/transitions/core/tests/phases.rs")]
718        /// ```
719        ///
720        #[doc = include_str!("../tests/transitions/core/docs/carrier.md")]
721        ///
722        /// ```rust
723        #[doc = include_str!("../tests/transitions/core/tests/carrier.rs")]
724        /// ```
725        pub mod core {}
726
727        /// Chains with and without an `error =` arg; factory carriers
728        /// without an error type still get the pipeline arm;
729        /// `Pipelined` supplies the `IntoFuture`.
730        ///
731        #[doc = include_str!("../tests/transitions/via_pipelined/docs/tests.md")]
732        ///
733        /// ## Test Cases
734        ///
735        #[doc = include_str!("../tests/transitions/via_pipelined/docs/transitions_chain_without_error_arg.md")]
736        ///
737        /// ```rust
738        #[doc = include_str!("../tests/transitions/via_pipelined/tests/transitions_chain_without_error_arg.rs")]
739        /// ```
740        ///
741        #[doc = include_str!("../tests/transitions/via_pipelined/docs/transitions_chain_propagates_error.md")]
742        ///
743        /// ```rust
744        #[doc = include_str!("../tests/transitions/via_pipelined/tests/transitions_chain_propagates_error.rs")]
745        /// ```
746        ///
747        #[doc = include_str!("../tests/transitions/via_pipelined/docs/factory_pipeline_arms_without_error_arg.md")]
748        ///
749        /// ```rust
750        #[doc = include_str!("../tests/transitions/via_pipelined/tests/factory_pipeline_arms_without_error_arg.rs")]
751        /// ```
752        ///
753        #[doc = include_str!("../tests/transitions/via_pipelined/docs/intofuture_provided_by_pipelined.md")]
754        ///
755        /// ```rust
756        #[doc = include_str!("../tests/transitions/via_pipelined/tests/intofuture_provided_by_pipelined.rs")]
757        /// ```
758        ///
759        /// ## Shared types and setup
760        ///
761        #[doc = include_str!("../tests/transitions/via_pipelined/docs/error.md")]
762        ///
763        /// ```rust
764        #[doc = include_str!("../tests/transitions/via_pipelined/tests/error.rs")]
765        /// ```
766        ///
767        #[doc = include_str!("../tests/transitions/via_pipelined/docs/phases.md")]
768        ///
769        /// ```rust
770        #[doc = include_str!("../tests/transitions/via_pipelined/tests/phases.rs")]
771        /// ```
772        ///
773        #[doc = include_str!("../tests/transitions/via_pipelined/docs/carrier.md")]
774        ///
775        /// ```rust
776        #[doc = include_str!("../tests/transitions/via_pipelined/tests/carrier.rs")]
777        /// ```
778        pub mod via_pipelined {}
779
780        /// Attributes on the source `impl` block forwarded to both
781        /// generated arms.
782        ///
783        #[doc = include_str!("../tests/transitions/attr_forwarding/docs/tests.md")]
784        ///
785        /// ## Test Cases
786        ///
787        #[doc = include_str!("../tests/transitions/attr_forwarding/docs/impl_attr_forwarded_to_both_arms.md")]
788        ///
789        /// ```rust
790        #[doc = include_str!("../tests/transitions/attr_forwarding/tests/impl_attr_forwarded_to_both_arms.rs")]
791        /// ```
792        pub mod attr_forwarding {}
793    }
794
795    /// Cross-feature scenarios — factory + pipeline + transitions
796    /// composing together.
797    pub mod integration {
798        /// Pipeline-arm setters from `#[factory(pipeline(carrier = …))]`:
799        /// the bag's setters / removers / overriders reach the user's
800        /// carrier in both Resolved and InFlight modes.
801        ///
802        #[doc = include_str!("../tests/integration/factory_pipeline/docs/tests.md")]
803        ///
804        /// ## Test Cases
805        ///
806        #[doc = include_str!("../tests/integration/factory_pipeline/docs/pipeline_setters_chain_in_resolved_mode.md")]
807        ///
808        /// ```rust
809        #[doc = include_str!("../tests/integration/factory_pipeline/tests/pipeline_setters_chain_in_resolved_mode.rs")]
810        /// ```
811        ///
812        #[doc = include_str!("../tests/integration/factory_pipeline/docs/pipeline_setters_chain_through_inflight.md")]
813        ///
814        /// ```rust
815        #[doc = include_str!("../tests/integration/factory_pipeline/tests/pipeline_setters_chain_through_inflight.rs")]
816        /// ```
817        ///
818        #[doc = include_str!("../tests/integration/factory_pipeline/docs/pipeline_drop_field_transitions_yes_to_no.md")]
819        ///
820        /// ```rust
821        #[doc = include_str!("../tests/integration/factory_pipeline/tests/pipeline_drop_field_transitions_yes_to_no.rs")]
822        /// ```
823        ///
824        #[doc = include_str!("../tests/integration/factory_pipeline/docs/pipeline_override_replaces_value.md")]
825        ///
826        /// ```rust
827        #[doc = include_str!("../tests/integration/factory_pipeline/tests/pipeline_override_replaces_value.rs")]
828        /// ```
829        ///
830        /// ## Shared types and setup
831        ///
832        #[doc = include_str!("../tests/integration/factory_pipeline/docs/error.md")]
833        ///
834        /// ```rust
835        #[doc = include_str!("../tests/integration/factory_pipeline/tests/error.rs")]
836        /// ```
837        ///
838        #[doc = include_str!("../tests/integration/factory_pipeline/docs/domain.md")]
839        ///
840        /// ```rust
841        #[doc = include_str!("../tests/integration/factory_pipeline/tests/domain.rs")]
842        /// ```
843        ///
844        #[doc = include_str!("../tests/integration/factory_pipeline/docs/carrier.md")]
845        ///
846        /// ```rust
847        #[doc = include_str!("../tests/integration/factory_pipeline/tests/carrier.rs")]
848        /// ```
849        pub mod factory_pipeline {}
850
851        /// Standalone bag's `finalize()` feeding a `#[transitions]` body
852        /// mid-chain; bag-level fallible finalize short-circuiting the
853        /// surrounding pipeline chain.
854        ///
855        #[doc = include_str!("../tests/integration/factory_in_pipeline/docs/tests.md")]
856        ///
857        /// ## Test Cases
858        ///
859        #[doc = include_str!("../tests/integration/factory_in_pipeline/docs/full_chain_bag_into_pipeline.md")]
860        ///
861        /// ```rust
862        #[doc = include_str!("../tests/integration/factory_in_pipeline/tests/full_chain_bag_into_pipeline.rs")]
863        /// ```
864        ///
865        #[doc = include_str!("../tests/integration/factory_in_pipeline/docs/validation_failure_at_bag_finalize.md")]
866        ///
867        /// ```rust
868        #[doc = include_str!("../tests/integration/factory_in_pipeline/tests/validation_failure_at_bag_finalize.rs")]
869        /// ```
870        ///
871        /// ## Shared types and setup
872        ///
873        #[doc = include_str!("../tests/integration/factory_in_pipeline/docs/error.md")]
874        ///
875        /// ```rust
876        #[doc = include_str!("../tests/integration/factory_in_pipeline/tests/error.rs")]
877        /// ```
878        ///
879        #[doc = include_str!("../tests/integration/factory_in_pipeline/docs/domain.md")]
880        ///
881        /// ```rust
882        #[doc = include_str!("../tests/integration/factory_in_pipeline/tests/domain.rs")]
883        /// ```
884        ///
885        #[doc = include_str!("../tests/integration/factory_in_pipeline/docs/phases.md")]
886        ///
887        /// ```rust
888        #[doc = include_str!("../tests/integration/factory_in_pipeline/tests/phases.rs")]
889        /// ```
890        ///
891        #[doc = include_str!("../tests/integration/factory_in_pipeline/docs/carrier.md")]
892        ///
893        /// ```rust
894        #[doc = include_str!("../tests/integration/factory_in_pipeline/tests/carrier.rs")]
895        /// ```
896        pub mod factory_in_pipeline {}
897
898        /// The full multi-phase authoring pipeline (gated on
899        /// `dataset-authoring-example`), patch-bump arithmetic, and typed
900        /// error variants on kind mismatch.
901        ///
902        #[doc = include_str!("../tests/integration/dataset_authoring/docs/tests.md")]
903        ///
904        /// ## Test Cases
905        ///
906        #[doc = include_str!("../tests/integration/dataset_authoring/docs/new_evm_rpc_flow_terminates_at_deployed.md")]
907        ///
908        /// ```rust
909        #[doc = include_str!("../tests/integration/dataset_authoring/tests/new_evm_rpc_flow_terminates_at_deployed.rs")]
910        /// ```
911        ///
912        #[doc = include_str!("../tests/integration/dataset_authoring/docs/new_derived_flow_chains_through_single_await.md")]
913        ///
914        /// ```rust
915        #[doc = include_str!("../tests/integration/dataset_authoring/tests/new_derived_flow_chains_through_single_await.rs")]
916        /// ```
917        ///
918        #[doc = include_str!("../tests/integration/dataset_authoring/docs/bump_patch_increments_existing_version.md")]
919        ///
920        /// ```rust
921        #[doc = include_str!("../tests/integration/dataset_authoring/tests/bump_patch_increments_existing_version.rs")]
922        /// ```
923        ///
924        #[doc = include_str!("../tests/integration/dataset_authoring/docs/bump_patch_errors_when_no_prior_version.md")]
925        ///
926        /// ```rust
927        #[doc = include_str!("../tests/integration/dataset_authoring/tests/bump_patch_errors_when_no_prior_version.rs")]
928        /// ```
929        ///
930        #[doc = include_str!("../tests/integration/dataset_authoring/docs/edit_existing_kind_mismatch_surfaces_error.md")]
931        ///
932        /// ```rust
933        #[doc = include_str!("../tests/integration/dataset_authoring/tests/edit_existing_kind_mismatch_surfaces_error.rs")]
934        /// ```
935        ///
936        /// ## Shared types and setup
937        ///
938        #[doc = include_str!("../tests/integration/dataset_authoring/docs/shared.md")]
939        ///
940        /// ```rust
941        #[doc = include_str!("../tests/integration/dataset_authoring/tests/shared.rs")]
942        /// ```
943        pub mod dataset_authoring {}
944    }
945
946    /// Dual-mode `Pipeline` carrier and `inspect` combinator.
947    pub mod pipeline {
948        /// `Pipelined` associated types and GAT projections,
949        /// `IntoFuture` driving InFlight to Resolved, carriers with
950        /// extra generics still satisfying `Pipelined`.
951        ///
952        #[doc = include_str!("../tests/pipeline/impl_pipelined/docs/tests.md")]
953        ///
954        /// ## Test Cases
955        ///
956        #[doc = include_str!("../tests/pipeline/impl_pipelined/docs/pipelined_associated_types_resolve.md")]
957        ///
958        /// ```rust
959        #[doc = include_str!("../tests/pipeline/impl_pipelined/tests/pipelined_associated_types_resolve.rs")]
960        /// ```
961        ///
962        #[doc = include_str!("../tests/pipeline/impl_pipelined/docs/gat_projections_are_correct.md")]
963        ///
964        /// ```rust
965        #[doc = include_str!("../tests/pipeline/impl_pipelined/tests/gat_projections_are_correct.rs")]
966        /// ```
967        ///
968        #[doc = include_str!("../tests/pipeline/impl_pipelined/docs/intofuture_drives_inflight_back_to_resolved.md")]
969        ///
970        /// ```rust
971        #[doc = include_str!("../tests/pipeline/impl_pipelined/tests/intofuture_drives_inflight_back_to_resolved.rs")]
972        /// ```
973        ///
974        #[doc = include_str!("../tests/pipeline/impl_pipelined/docs/tagged_pipelined_resolves.md")]
975        ///
976        /// ```rust
977        #[doc = include_str!("../tests/pipeline/impl_pipelined/tests/tagged_pipelined_resolves.rs")]
978        /// ```
979        ///
980        /// ## Shared types and setup
981        ///
982        #[doc = include_str!("../tests/pipeline/impl_pipelined/docs/error.md")]
983        ///
984        /// ```rust
985        #[doc = include_str!("../tests/pipeline/impl_pipelined/tests/error.rs")]
986        /// ```
987        ///
988        #[doc = include_str!("../tests/pipeline/impl_pipelined/docs/state_types.md")]
989        ///
990        /// ```rust
991        #[doc = include_str!("../tests/pipeline/impl_pipelined/tests/state_types.rs")]
992        /// ```
993        ///
994        #[doc = include_str!("../tests/pipeline/impl_pipelined/docs/carriers.md")]
995        ///
996        /// ```rust
997        #[doc = include_str!("../tests/pipeline/impl_pipelined/tests/carriers.rs")]
998        /// ```
999        pub mod impl_pipelined {}
1000
1001        /// `inspect(|c| …)` runs synchronously on Resolved, runs after
1002        /// the pending future resolves on InFlight, preserves the
1003        /// chain in both cases.
1004        ///
1005        #[doc = include_str!("../tests/pipeline/inspect/docs/tests.md")]
1006        ///
1007        /// ## Test Cases
1008        ///
1009        #[doc = include_str!("../tests/pipeline/inspect/docs/resolved_inspect_runs_sync_and_preserves_chain.md")]
1010        ///
1011        /// ```rust
1012        #[doc = include_str!("../tests/pipeline/inspect/tests/resolved_inspect_runs_sync_and_preserves_chain.rs")]
1013        /// ```
1014        ///
1015        #[doc = include_str!("../tests/pipeline/inspect/docs/resolved_inspect_does_not_change_typestate.md")]
1016        ///
1017        /// ```rust
1018        #[doc = include_str!("../tests/pipeline/inspect/tests/resolved_inspect_does_not_change_typestate.rs")]
1019        /// ```
1020        ///
1021        #[doc = include_str!("../tests/pipeline/inspect/docs/inflight_inspect_runs_after_pending_resolves.md")]
1022        ///
1023        /// ```rust
1024        #[doc = include_str!("../tests/pipeline/inspect/tests/inflight_inspect_runs_after_pending_resolves.rs")]
1025        /// ```
1026        ///
1027        #[doc = include_str!("../tests/pipeline/inspect/docs/inflight_inspect_chains_through_subsequent_transitions.md")]
1028        ///
1029        /// ```rust
1030        #[doc = include_str!("../tests/pipeline/inspect/tests/inflight_inspect_chains_through_subsequent_transitions.rs")]
1031        /// ```
1032        ///
1033        /// ## Shared types and setup
1034        ///
1035        #[doc = include_str!("../tests/pipeline/inspect/docs/error.md")]
1036        ///
1037        /// ```rust
1038        #[doc = include_str!("../tests/pipeline/inspect/tests/error.rs")]
1039        /// ```
1040        ///
1041        #[doc = include_str!("../tests/pipeline/inspect/docs/phases.md")]
1042        ///
1043        /// ```rust
1044        #[doc = include_str!("../tests/pipeline/inspect/tests/phases.rs")]
1045        /// ```
1046        ///
1047        #[doc = include_str!("../tests/pipeline/inspect/docs/carrier.md")]
1048        ///
1049        /// ```rust
1050        #[doc = include_str!("../tests/pipeline/inspect/tests/carrier.rs")]
1051        /// ```
1052        pub mod inspect {}
1053    }
1054
1055    /// Safety properties of the unsafe-mode and `no_unsafe` codegen
1056    /// paths — the regression guards behind every safety claim in the
1057    /// crate-level `Safety` section.
1058    pub mod safety {
1059        /// A failing fallible setter, a failing fallible overrider,
1060        /// and an async setter dropped mid-`await` all release every
1061        /// previously-set field — no `ManuallyDrop` leak.
1062        ///
1063        #[doc = include_str!("../tests/safety/factory_no_leak/docs/tests.md")]
1064        ///
1065        /// # Test Cases
1066        ///
1067        #[doc = include_str!("../tests/safety/factory_no_leak/docs/fallible_setter_failure_drops_other_set_fields.md")]
1068        ///
1069        /// ```rust
1070        #[doc = include_str!("../tests/safety/factory_no_leak/tests/fallible_setter_failure_drops_other_set_fields.rs")]
1071        /// ```
1072        ///
1073        #[doc = include_str!("../tests/safety/factory_no_leak/docs/fallible_overrider_failure_drops_other_set_fields.md")]
1074        ///
1075        /// ```rust
1076        #[doc = include_str!("../tests/safety/factory_no_leak/tests/fallible_overrider_failure_drops_other_set_fields.rs")]
1077        /// ```
1078        ///
1079        #[doc = include_str!("../tests/safety/factory_no_leak/docs/async_setter_dropped_mid_await_drops_other_set_fields.md")]
1080        ///
1081        /// ```rust
1082        #[doc = include_str!("../tests/safety/factory_no_leak/tests/async_setter_dropped_mid_await_drops_other_set_fields.rs")]
1083        /// ```
1084        ///
1085        /// ## Shared types and setup
1086        ///
1087        #[doc = include_str!("../tests/safety/factory_no_leak/docs/error.md")]
1088        ///
1089        /// ```rust
1090        #[doc = include_str!("../tests/safety/factory_no_leak/tests/error.rs")]
1091        /// ```
1092        ///
1093        #[doc = include_str!("../tests/safety/factory_no_leak/docs/bookkeeping.md")]
1094        ///
1095        /// ```rust
1096        #[doc = include_str!("../tests/safety/factory_no_leak/tests/bookkeeping.rs")]
1097        /// ```
1098        ///
1099        pub mod factory_no_leak {}
1100
1101        /// Panicking destructors and panicking `default = …` expressions
1102        /// must not leak the bag's other set fields. Pinned across the
1103        /// bag's `Drop`, `finalize`'s default branch, and the
1104        /// `override`/`drop_<field>` paths.
1105        ///
1106        #[doc = include_str!("../tests/safety/factory_panic_safety/docs/tests.md")]
1107        ///
1108        /// ## Test Cases
1109        ///
1110        #[doc = include_str!("../tests/safety/factory_panic_safety/docs/panic_in_drop_still_drops_subsequent_fields.md")]
1111        ///
1112        /// ```rust
1113        #[doc = include_str!("../tests/safety/factory_panic_safety/tests/panic_in_drop_still_drops_subsequent_fields.rs")]
1114        /// ```
1115        ///
1116        #[doc = include_str!("../tests/safety/factory_panic_safety/docs/panic_in_default_expr_during_finalize_drops_already_read_fields.md")]
1117        ///
1118        /// ```rust
1119        #[doc = include_str!("../tests/safety/factory_panic_safety/tests/panic_in_default_expr_during_finalize_drops_already_read_fields.rs")]
1120        /// ```
1121        ///
1122        #[doc = include_str!("../tests/safety/factory_panic_safety/docs/panic_in_old_value_drop_during_override_drops_other_fields.md")]
1123        ///
1124        /// ```rust
1125        #[doc = include_str!("../tests/safety/factory_panic_safety/tests/panic_in_old_value_drop_during_override_drops_other_fields.rs")]
1126        /// ```
1127        ///
1128        #[doc = include_str!("../tests/safety/factory_panic_safety/docs/panic_in_old_value_drop_during_remove_drops_other_fields.md")]
1129        ///
1130        /// ```rust
1131        #[doc = include_str!("../tests/safety/factory_panic_safety/tests/panic_in_old_value_drop_during_remove_drops_other_fields.rs")]
1132        /// ```
1133        ///
1134        /// ## Shared types and setup
1135        ///
1136        #[doc = include_str!("../tests/safety/factory_panic_safety/docs/bookkeeping.md")]
1137        ///
1138        /// ```rust
1139        #[doc = include_str!("../tests/safety/factory_panic_safety/tests/bookkeeping.rs")]
1140        /// ```
1141        ///
1142        #[doc = include_str!("../tests/safety/factory_panic_safety/docs/panicky_drop.md")]
1143        ///
1144        /// ```rust
1145        #[doc = include_str!("../tests/safety/factory_panic_safety/tests/panicky_drop.rs")]
1146        /// ```
1147        pub mod factory_panic_safety {}
1148
1149        /// Macro internals are prefixed with `__tsh_` so a struct with
1150        /// fields named `_markers`, `this`, `__field_value`,
1151        /// `__old_field`, or `__new_bag` compiles cleanly. Default
1152        /// expressions still resolve free functions in the user's scope.
1153        ///
1154        #[doc = include_str!("../tests/safety/factory_hygiene/docs/tests.md")]
1155        ///
1156        /// # Test Cases
1157        ///
1158        #[doc = include_str!("../tests/safety/factory_hygiene/docs/struct_with_field_names_matching_macro_internals_compiles.md")]
1159        ///
1160        /// ```rust
1161        #[doc = include_str!("../tests/safety/factory_hygiene/tests/struct_with_field_names_matching_macro_internals_compiles.rs")]
1162        /// ```
1163        ///
1164        #[doc = include_str!("../tests/safety/factory_hygiene/docs/default_expression_can_call_user_scope_function.md")]
1165        ///
1166        /// ```rust
1167        #[doc = include_str!("../tests/safety/factory_hygiene/tests/default_expression_can_call_user_scope_function.rs")]
1168        /// ```
1169        pub mod factory_hygiene {}
1170
1171        /// Bags with zero, one, and many flag generics all round-trip
1172        /// through `finalize`. The trailing-comma `PhantomData<(F,)>`
1173        /// marker preserves `Send`/`Sync` auto-trait forwarding for the
1174        /// singleton case (without it, the marker would collapse to
1175        /// `PhantomData<F>` and silently change variance).
1176        ///
1177        #[doc = include_str!("../tests/safety/factory_phantom_shape/docs/tests.md")]
1178        ///
1179        /// ## Test Cases
1180        ///
1181        #[doc = include_str!("../tests/safety/factory_phantom_shape/docs/all_internal_struct_finalizes_without_flag_generics.md")]
1182        ///
1183        /// ```rust
1184        #[doc = include_str!("../tests/safety/factory_phantom_shape/tests/all_internal_struct_finalizes_without_flag_generics.rs")]
1185        /// ```
1186        ///
1187        #[doc = include_str!("../tests/safety/factory_phantom_shape/docs/singleton_flag_struct_round_trips.md")]
1188        ///
1189        /// ```rust
1190        #[doc = include_str!("../tests/safety/factory_phantom_shape/tests/singleton_flag_struct_round_trips.rs")]
1191        /// ```
1192        ///
1193        #[doc = include_str!("../tests/safety/factory_phantom_shape/docs/one_flag_bag_is_send_and_sync_when_field_is.md")]
1194        ///
1195        /// ```rust
1196        #[doc = include_str!("../tests/safety/factory_phantom_shape/tests/one_flag_bag_is_send_and_sync_when_field_is.rs")]
1197        /// ```
1198        ///
1199        #[doc = include_str!("../tests/safety/factory_phantom_shape/docs/many_flag_struct_round_trips.md")]
1200        ///
1201        /// ```rust
1202        #[doc = include_str!("../tests/safety/factory_phantom_shape/tests/many_flag_struct_round_trips.rs")]
1203        /// ```
1204        pub mod factory_phantom_shape {}
1205
1206        /// Parallel coverage suite for the `no_unsafe`-mode codegen
1207        /// path — every safety guarantee from the unsafe-mode tests
1208        /// holds in safe mode without `MaybeUninit`.
1209        ///
1210        #[doc = include_str!("../tests/safety/factory_no_unsafe/docs/tests.md")]
1211        ///
1212        /// ## Test Cases
1213        ///
1214        #[doc = include_str!("../tests/safety/factory_no_unsafe/docs/build_in_order.md")]
1215        ///
1216        /// ```rust
1217        #[doc = include_str!("../tests/safety/factory_no_unsafe/tests/build_in_order.rs")]
1218        /// ```
1219        ///
1220        #[doc = include_str!("../tests/safety/factory_no_unsafe/docs/build_in_arbitrary_order.md")]
1221        ///
1222        /// ```rust
1223        #[doc = include_str!("../tests/safety/factory_no_unsafe/tests/build_in_arbitrary_order.rs")]
1224        /// ```
1225        ///
1226        #[doc = include_str!("../tests/safety/factory_no_unsafe/docs/default_helper_fills_in_optional.md")]
1227        ///
1228        /// ```rust
1229        #[doc = include_str!("../tests/safety/factory_no_unsafe/tests/default_helper_fills_in_optional.rs")]
1230        /// ```
1231        ///
1232        #[doc = include_str!("../tests/safety/factory_no_unsafe/docs/finalize_uses_default_when_optional_unset.md")]
1233        ///
1234        /// ```rust
1235        #[doc = include_str!("../tests/safety/factory_no_unsafe/tests/finalize_uses_default_when_optional_unset.rs")]
1236        /// ```
1237        ///
1238        #[doc = include_str!("../tests/safety/factory_no_unsafe/docs/getter_borrows_set_field.md")]
1239        ///
1240        /// ```rust
1241        #[doc = include_str!("../tests/safety/factory_no_unsafe/tests/getter_borrows_set_field.rs")]
1242        /// ```
1243        ///
1244        #[doc = include_str!("../tests/safety/factory_no_unsafe/docs/empty_bag_dropped_does_not_touch_unset_fields.md")]
1245        ///
1246        /// ```rust
1247        #[doc = include_str!("../tests/safety/factory_no_unsafe/tests/empty_bag_dropped_does_not_touch_unset_fields.rs")]
1248        /// ```
1249        ///
1250        #[doc = include_str!("../tests/safety/factory_no_unsafe/docs/partial_bag_dropped_drops_only_set_fields.md")]
1251        ///
1252        /// ```rust
1253        #[doc = include_str!("../tests/safety/factory_no_unsafe/tests/partial_bag_dropped_drops_only_set_fields.rs")]
1254        /// ```
1255        ///
1256        #[doc = include_str!("../tests/safety/factory_no_unsafe/docs/fully_populated_bag_dropped_drops_all.md")]
1257        ///
1258        /// ```rust
1259        #[doc = include_str!("../tests/safety/factory_no_unsafe/tests/fully_populated_bag_dropped_drops_all.rs")]
1260        /// ```
1261        ///
1262        #[doc = include_str!("../tests/safety/factory_no_unsafe/docs/finalize_does_not_double_drop.md")]
1263        ///
1264        /// ```rust
1265        #[doc = include_str!("../tests/safety/factory_no_unsafe/tests/finalize_does_not_double_drop.rs")]
1266        /// ```
1267        ///
1268        #[doc = include_str!("../tests/safety/factory_no_unsafe/docs/drop_field_drops_value_once.md")]
1269        ///
1270        /// ```rust
1271        #[doc = include_str!("../tests/safety/factory_no_unsafe/tests/drop_field_drops_value_once.rs")]
1272        /// ```
1273        ///
1274        #[doc = include_str!("../tests/safety/factory_no_unsafe/docs/drop_field_then_reset_doesnt_double_drop.md")]
1275        ///
1276        /// ```rust
1277        #[doc = include_str!("../tests/safety/factory_no_unsafe/tests/drop_field_then_reset_doesnt_double_drop.rs")]
1278        /// ```
1279        ///
1280        #[doc = include_str!("../tests/safety/factory_no_unsafe/docs/override_drops_old_value.md")]
1281        ///
1282        /// ```rust
1283        #[doc = include_str!("../tests/safety/factory_no_unsafe/tests/override_drops_old_value.rs")]
1284        /// ```
1285        ///
1286        #[doc = include_str!("../tests/safety/factory_no_unsafe/docs/finalize_uses_defaults_when_optional_no.md")]
1287        ///
1288        /// ```rust
1289        #[doc = include_str!("../tests/safety/factory_no_unsafe/tests/finalize_uses_defaults_when_optional_no.rs")]
1290        /// ```
1291        ///
1292        #[doc = include_str!("../tests/safety/factory_no_unsafe/docs/finalize_keeps_explicit_values_when_optional_yes.md")]
1293        ///
1294        /// ```rust
1295        #[doc = include_str!("../tests/safety/factory_no_unsafe/tests/finalize_keeps_explicit_values_when_optional_yes.rs")]
1296        /// ```
1297        ///
1298        #[doc = include_str!("../tests/safety/factory_no_unsafe/docs/finalize_mixes_set_and_default.md")]
1299        ///
1300        /// ```rust
1301        #[doc = include_str!("../tests/safety/factory_no_unsafe/tests/finalize_mixes_set_and_default.rs")]
1302        /// ```
1303        ///
1304        #[doc = include_str!("../tests/safety/factory_no_unsafe/docs/custom_transformer_fn.md")]
1305        ///
1306        /// ```rust
1307        #[doc = include_str!("../tests/safety/factory_no_unsafe/tests/custom_transformer_fn.rs")]
1308        /// ```
1309        ///
1310        #[doc = include_str!("../tests/safety/factory_no_unsafe/docs/fallible_transformer_success.md")]
1311        ///
1312        /// ```rust
1313        #[doc = include_str!("../tests/safety/factory_no_unsafe/tests/fallible_transformer_success.rs")]
1314        /// ```
1315        ///
1316        #[doc = include_str!("../tests/safety/factory_no_unsafe/docs/fallible_transformer_failure.md")]
1317        ///
1318        /// ```rust
1319        #[doc = include_str!("../tests/safety/factory_no_unsafe/tests/fallible_transformer_failure.rs")]
1320        /// ```
1321        ///
1322        #[doc = include_str!("../tests/safety/factory_no_unsafe/docs/fallible_setter_failure_drops_other_set_fields.md")]
1323        ///
1324        /// ```rust
1325        #[doc = include_str!("../tests/safety/factory_no_unsafe/tests/fallible_setter_failure_drops_other_set_fields.rs")]
1326        /// ```
1327        ///
1328        #[doc = include_str!("../tests/safety/factory_no_unsafe/docs/fallible_overrider_failure_drops_other_set_fields.md")]
1329        ///
1330        /// ```rust
1331        #[doc = include_str!("../tests/safety/factory_no_unsafe/tests/fallible_overrider_failure_drops_other_set_fields.rs")]
1332        /// ```
1333        ///
1334        #[doc = include_str!("../tests/safety/factory_no_unsafe/docs/async_setter_dropped_mid_await_drops_other_set_fields.md")]
1335        ///
1336        /// ```rust
1337        #[doc = include_str!("../tests/safety/factory_no_unsafe/tests/async_setter_dropped_mid_await_drops_other_set_fields.rs")]
1338        /// ```
1339        ///
1340        #[doc = include_str!("../tests/safety/factory_no_unsafe/docs/internal_field_round_trips.md")]
1341        ///
1342        /// ```rust
1343        #[doc = include_str!("../tests/safety/factory_no_unsafe/tests/internal_field_round_trips.rs")]
1344        /// ```
1345        ///
1346        /// ## Shared types and setup
1347        ///
1348        #[doc = include_str!("../tests/safety/factory_no_unsafe/docs/error.md")]
1349        ///
1350        /// ```rust
1351        #[doc = include_str!("../tests/safety/factory_no_unsafe/tests/error.rs")]
1352        /// ```
1353        ///
1354        #[doc = include_str!("../tests/safety/factory_no_unsafe/docs/bookkeeping.md")]
1355        ///
1356        /// ```rust
1357        #[doc = include_str!("../tests/safety/factory_no_unsafe/tests/bookkeeping.rs")]
1358        /// ```
1359        ///
1360        #[doc = include_str!("../tests/safety/factory_no_unsafe/docs/async_helpers.md")]
1361        ///
1362        /// ```rust
1363        #[doc = include_str!("../tests/safety/factory_no_unsafe/tests/async_helpers.rs")]
1364        /// ```
1365        pub mod factory_no_unsafe {}
1366    }
1367
1368    /// Compile-fail diagnostics — what users see when they misuse the
1369    /// macros. Each page pairs the trybuild source with the pinned
1370    /// `.stderr` snapshot.
1371    pub mod ui {
1372        /// `<field>_default()` requires `default = …` on the field.
1373        ///
1374        /// # Source
1375        ///
1376        /// ```rust,ignore
1377        #[doc = include_str!("../tests/ui/stable/default_helper_without_default.rs")]
1378        /// ```
1379        ///
1380        /// # Expected diagnostic
1381        #[doc = include_str!(concat!(env!("OUT_DIR"), "/diagnostics/default_helper_without_default.html"))]
1382        pub mod default_helper_without_default {}
1383
1384        /// `default = …` and `async_fn` are mutually exclusive — defaults
1385        /// must be synchronous expressions.
1386        ///
1387        /// # Source
1388        ///
1389        /// ```rust,ignore
1390        #[doc = include_str!("../tests/ui/stable/default_with_async.rs")]
1391        /// ```
1392        ///
1393        /// # Expected diagnostic
1394        #[doc = include_str!(concat!(env!("OUT_DIR"), "/diagnostics/default_with_async.html"))]
1395        pub mod default_with_async {}
1396
1397        /// `default = …` and `fallible` are mutually exclusive.
1398        ///
1399        /// # Source
1400        ///
1401        /// ```rust,ignore
1402        #[doc = include_str!("../tests/ui/stable/default_with_fallible.rs")]
1403        /// ```
1404        ///
1405        /// # Expected diagnostic
1406        #[doc = include_str!(concat!(env!("OUT_DIR"), "/diagnostics/default_with_fallible.html"))]
1407        pub mod default_with_fallible {}
1408
1409        /// `async_fn` requires `setter = …`.
1410        ///
1411        /// # Source
1412        ///
1413        /// ```rust,ignore
1414        #[doc = include_str!("../tests/ui/stable/factory_async_without_setter.rs")]
1415        /// ```
1416        ///
1417        /// # Expected diagnostic
1418        #[doc = include_str!(concat!(env!("OUT_DIR"), "/diagnostics/factory_async_without_setter.html"))]
1419        pub mod factory_async_without_setter {}
1420
1421        /// `fallible` requires `setter = …`.
1422        ///
1423        /// # Source
1424        ///
1425        /// ```rust,ignore
1426        #[doc = include_str!("../tests/ui/stable/factory_fallible_without_setter.rs")]
1427        /// ```
1428        ///
1429        /// # Expected diagnostic
1430        #[doc = include_str!(concat!(env!("OUT_DIR"), "/diagnostics/factory_fallible_without_setter.html"))]
1431        pub mod factory_fallible_without_setter {}
1432
1433        /// `#[factory(no_unsafe)]` is rejected when the `no_unsafe`
1434        /// Cargo feature is off.
1435        ///
1436        /// # Source
1437        ///
1438        /// ```rust,ignore
1439        #[doc = include_str!("../tests/ui/stable/factory_no_unsafe_without_feature.rs")]
1440        /// ```
1441        ///
1442        /// # Expected diagnostic
1443        #[doc = include_str!(concat!(env!("OUT_DIR"), "/diagnostics/factory_no_unsafe_without_feature.html"))]
1444        pub mod factory_no_unsafe_without_feature {}
1445
1446        /// `#[derive(TypestateFactory)]` requires a struct.
1447        ///
1448        /// # Source
1449        ///
1450        /// ```rust,ignore
1451        #[doc = include_str!("../tests/ui/stable/factory_on_enum.rs")]
1452        /// ```
1453        ///
1454        /// # Expected diagnostic
1455        #[doc = include_str!(concat!(env!("OUT_DIR"), "/diagnostics/factory_on_enum.html"))]
1456        pub mod factory_on_enum {}
1457
1458        /// `input = T` requires `setter = …`.
1459        ///
1460        /// # Source
1461        ///
1462        /// ```rust,ignore
1463        #[doc = include_str!("../tests/ui/stable/input_without_setter.rs")]
1464        /// ```
1465        ///
1466        /// # Expected diagnostic
1467        #[doc = include_str!(concat!(env!("OUT_DIR"), "/diagnostics/input_without_setter.html"))]
1468        pub mod input_without_setter {}
1469
1470        /// `internal` fields don't get pipeline-arm methods even when
1471        /// `pipeline(carrier = …)` is set.
1472        ///
1473        /// # Source
1474        ///
1475        /// ```rust,ignore
1476        #[doc = include_str!("../tests/ui/stable/internal_field_no_pipeline_arm.rs")]
1477        /// ```
1478        ///
1479        /// # Expected diagnostic
1480        #[doc = include_str!(concat!(env!("OUT_DIR"), "/diagnostics/internal_field_no_pipeline_arm.html"))]
1481        pub mod internal_field_no_pipeline_arm {}
1482
1483        /// `internal` fields cannot have a `setter = …` — they're
1484        /// positional on `new(…)` and have no setter.
1485        ///
1486        /// # Source
1487        ///
1488        /// ```rust,ignore
1489        #[doc = include_str!("../tests/ui/stable/internal_with_setter.rs")]
1490        /// ```
1491        ///
1492        /// # Expected diagnostic
1493        #[doc = include_str!(concat!(env!("OUT_DIR"), "/diagnostics/internal_with_setter.html"))]
1494        pub mod internal_with_setter {}
1495
1496        /// `Pipeline::ctx` and `Pipeline::inner` are sealed — reading
1497        /// them from a downstream carrier newtype fails the privacy
1498        /// check, with a hint pointing at `ctx()` / `into_parts()`.
1499        ///
1500        /// # Source
1501        ///
1502        /// ```rust,ignore
1503        #[doc = include_str!("../tests/ui/stable/pipeline_field_is_private.rs")]
1504        /// ```
1505        ///
1506        /// # Expected diagnostic
1507        #[doc = include_str!(concat!(env!("OUT_DIR"), "/diagnostics/pipeline_field_is_private.html"))]
1508        pub mod pipeline_field_is_private {}
1509
1510        /// `<Bag>Ready` does not auto-impl when a required flag is
1511        /// `No` — generic dispatch over `B: <Bag>Ready` is rejected for
1512        /// unfinalized bags.
1513        ///
1514        /// # Source
1515        ///
1516        /// ```rust,ignore
1517        #[doc = include_str!("../tests/ui/stable/ready_trait_rejects_unset_required.rs")]
1518        /// ```
1519        ///
1520        /// # Expected diagnostic
1521        #[doc = include_str!(concat!(env!("OUT_DIR"), "/diagnostics/ready_trait_rejects_unset_required.html"))]
1522        pub mod ready_trait_rejects_unset_required {}
1523
1524        /// `#[transition]` requires `into = <Type>`.
1525        ///
1526        /// # Source
1527        ///
1528        /// ```rust,ignore
1529        #[doc = include_str!("../tests/ui/stable/transition_without_into.rs")]
1530        /// ```
1531        ///
1532        /// # Expected diagnostic
1533        #[doc = include_str!(concat!(env!("OUT_DIR"), "/diagnostics/transition_without_into.html"))]
1534        pub mod transition_without_into {}
1535
1536        /// `breakpoint` is only meaningful on `async fn` bodies.
1537        ///
1538        /// # Source
1539        ///
1540        /// ```rust,ignore
1541        #[doc = include_str!("../tests/ui/stable/transitions_breakpoint_on_sync.rs")]
1542        /// ```
1543        ///
1544        /// # Expected diagnostic
1545        #[doc = include_str!(concat!(env!("OUT_DIR"), "/diagnostics/transitions_breakpoint_on_sync.html"))]
1546        pub mod transitions_breakpoint_on_sync {}
1547
1548        /// `breakpoint` is a flag (no value) — `breakpoint = true` is rejected.
1549        ///
1550        /// # Source
1551        ///
1552        /// ```rust,ignore
1553        #[doc = include_str!("../tests/ui/stable/transitions_breakpoint_with_value.rs")]
1554        /// ```
1555        ///
1556        /// # Expected diagnostic
1557        #[doc = include_str!(concat!(env!("OUT_DIR"), "/diagnostics/transitions_breakpoint_with_value.html"))]
1558        pub mod transitions_breakpoint_with_value {}
1559
1560        /// A `#[transition]` body's first parameter must be `state: <State>`.
1561        ///
1562        /// # Source
1563        ///
1564        /// ```rust,ignore
1565        #[doc = include_str!("../tests/ui/stable/transitions_first_param_not_state.rs")]
1566        /// ```
1567        ///
1568        /// # Expected diagnostic
1569        #[doc = include_str!(concat!(env!("OUT_DIR"), "/diagnostics/transitions_first_param_not_state.html"))]
1570        pub mod transitions_first_param_not_state {}
1571
1572        /// `#[transitions]` only decorates inherent `impl` blocks — not
1573        /// trait `impl`s.
1574        ///
1575        /// # Source
1576        ///
1577        /// ```rust,ignore
1578        #[doc = include_str!("../tests/ui/stable/transitions_on_trait_impl.rs")]
1579        /// ```
1580        ///
1581        /// # Expected diagnostic
1582        #[doc = include_str!(concat!(env!("OUT_DIR"), "/diagnostics/transitions_on_trait_impl.html"))]
1583        pub mod transitions_on_trait_impl {}
1584
1585        /// `#[transitions]` requires the carrier type to implement
1586        /// `Pipelined<'a>`.
1587        ///
1588        /// # Source
1589        ///
1590        /// ```rust,ignore
1591        #[doc = include_str!("../tests/ui/stable/transitions_without_pipelined_impl.rs")]
1592        /// ```
1593        ///
1594        /// # Expected diagnostic
1595        #[doc = include_str!(concat!(env!("OUT_DIR"), "/diagnostics/transitions_without_pipelined_impl.html"))]
1596        pub mod transitions_without_pipelined_impl {}
1597    }
1598}
1599
1600/// Declare a typestate carrier in one line: emits the newtype struct, its
1601/// `where M: Mode<…>` clause, the [`Pipelined`] impl, and the
1602/// [`IntoFuture`](core::future::IntoFuture) forwarding for `InFlight` mode.
1603///
1604/// ```no_run
1605/// # pub struct Client;
1606/// # #[derive(Debug)] pub struct AuthoringError;
1607/// typestate_pipeline::pipelined!(pub Author, ctx = Client, error = AuthoringError);
1608/// // optional: tag = MyTag (default `()`)
1609/// ```
1610///
1611/// Expands to:
1612///
1613/// ```text
1614/// pub struct Author<'a, S, M = Resolved>(Pipeline<'a, Client, (), S, AuthoringError, M>)
1615/// where M: Mode<'a, S, AuthoringError>;
1616/// // + Pipelined<'a> impl + IntoFuture forwarding
1617/// ```
1618///
1619/// Use [`impl_pipelined!`] when you need to hand-write the struct (custom
1620/// derives, extra generics like `<'a, K: Kind, S, M>`, etc.).
1621#[doc(alias = "carrier")]
1622#[doc(alias = "newtype")]
1623#[macro_export]
1624macro_rules! pipelined {
1625    ($vis:vis $name:ident, ctx = $ctx:ty, error = $err:ty $(,)?) => {
1626        $crate::pipelined!($vis $name, ctx = $ctx, error = $err, tag = ());
1627    };
1628
1629    ($vis:vis $name:ident, ctx = $ctx:ty, error = $err:ty, tag = $tag:ty $(,)?) => {
1630        $vis struct $name<'a, S, M = $crate::Resolved>(
1631            $crate::Pipeline<'a, $ctx, $tag, S, $err, M>,
1632        )
1633        where
1634            M: $crate::Mode<'a, S, $err>;
1635
1636        $crate::impl_pipelined!($name, ctx = $ctx, error = $err, tag = $tag);
1637    };
1638}
1639
1640/// Implement [`Pipelined`] and [`IntoFuture`](core::future::IntoFuture) for
1641/// an existing carrier newtype, plus the chainable `inspect` combinator on
1642/// both `Resolved` and `InFlight` modes.
1643///
1644/// The carrier must be a tuple-struct newtype around `Pipeline` with the
1645/// generic shape `<'a, S, M = Resolved>`:
1646///
1647/// ```no_run
1648/// # struct Client;
1649/// # #[derive(Debug)] struct AuthoringError;
1650/// use typestate_pipeline::{Mode, Pipeline, Resolved};
1651///
1652/// struct Author<'a, S, M = Resolved>(Pipeline<'a, Client, (), S, AuthoringError, M>)
1653/// where M: Mode<'a, S, AuthoringError>;
1654///
1655/// typestate_pipeline::impl_pipelined!(Author, ctx = Client, error = AuthoringError);
1656/// ```
1657///
1658/// For the common case where you do not need to customize the struct, use
1659/// [`pipelined!`] which emits both in one line.
1660#[doc(alias = "carrier")]
1661#[macro_export]
1662macro_rules! impl_pipelined {
1663    ($carrier:ident, ctx = $ctx:ty, error = $err:ty $(,)?) => {
1664        $crate::impl_pipelined!($carrier, ctx = $ctx, error = $err, tag = ());
1665    };
1666
1667    ($carrier:ident, ctx = $ctx:ty, error = $err:ty, tag = $tag:ty $(,)?) => {
1668        impl<'a, S: 'a, M> $crate::Pipelined<'a> for $carrier<'a, S, M>
1669        where
1670            M: $crate::Mode<'a, S, $err>,
1671        {
1672            type Ctx = $ctx;
1673            type Error = $err;
1674            type Tag = $tag;
1675            type State = S;
1676            type Mode = M;
1677            type Resolved<NS: 'a> = $carrier<'a, NS, $crate::Resolved>;
1678            type InFlight<NS: ::core::marker::Send + 'a> = $carrier<'a, NS, $crate::InFlight>;
1679        }
1680
1681        impl<'a, S> ::core::future::IntoFuture for $carrier<'a, S, $crate::InFlight>
1682        where
1683            S: ::core::marker::Send + 'a,
1684            $err: ::core::marker::Send + 'a,
1685            $ctx: ::core::marker::Sync + 'a,
1686        {
1687            type Output = ::core::result::Result<$carrier<'a, S, $crate::Resolved>, $err>;
1688            type IntoFuture = $crate::BoxFuture<'a, Self::Output>;
1689            fn into_future(self) -> Self::IntoFuture {
1690                let pending = self.0;
1691                $crate::__private::Box::pin(async move {
1692                    let resolved = pending.await?;
1693                    ::core::result::Result::Ok($carrier(resolved))
1694                })
1695            }
1696        }
1697
1698        impl<'a, S: 'a> $carrier<'a, S, $crate::Resolved> {
1699            /// Pause the chain to inspect the resolved carrier without
1700            /// changing it. The closure receives `&Self`; the carrier is
1701            /// returned unchanged so the chain continues.
1702            #[inline]
1703            pub fn inspect<F>(self, inspect_op: F) -> Self
1704            where
1705                F: ::core::ops::FnOnce(&Self),
1706            {
1707                inspect_op(&self);
1708                self
1709            }
1710        }
1711
1712        impl<'a, S> $carrier<'a, S, $crate::InFlight>
1713        where
1714            S: ::core::marker::Send + 'a,
1715            $err: ::core::marker::Send + 'a,
1716            $ctx: ::core::marker::Sync + 'a,
1717        {
1718            /// Pause the in-flight chain to inspect the eventual resolved
1719            /// carrier without changing it.
1720            ///
1721            /// The closure runs *after* the chain's pending future
1722            /// resolves, against a temporary [`Resolved`](crate::Resolved)
1723            /// carrier reference (so getters on the carrier work). The
1724            /// chain re-enters `InFlight` so subsequent transitions
1725            /// continue folding into the same terminal `.await?`.
1726            #[inline]
1727            pub fn inspect<F>(self, inspect_op: F) -> Self
1728            where
1729                F: ::core::ops::FnOnce(&$carrier<'a, S, $crate::Resolved>)
1730                    + ::core::marker::Send
1731                    + 'a,
1732            {
1733                let pending = self.0;
1734                let ctx = pending.ctx();
1735                $carrier($crate::__private::Pipeline::in_flight(
1736                    ctx,
1737                    $crate::__private::Box::pin(async move {
1738                        let resolved = pending.await?;
1739                        let temp = $carrier(resolved);
1740                        inspect_op(&temp);
1741                        ::core::result::Result::Ok(temp.0.into_state())
1742                    }),
1743                ))
1744            }
1745        }
1746    };
1747}