Expand description
The flat model itself lives in the separate prebindgen-flat crate —
re-exported here so an adapter names one crate root for the whole
pipeline.
Shape<N> — a leaf wrapped in an ordered stack of structural layers
(Option, Vec), with a bottom-up fold_shape combinator.
One shared algebra replaces the three former per-module copies of the same “leaf + wrapper layers” idea:
- jnigen’s
FoldStrategy(Direct/Nullable { kind, inner }/Iterable) →Shape<NullableKind>(theOptionallayer carries the null-representation choice), - expand’s
FoldShape(Construct/Optional/Iterable) →Shape(=Shape<()>), - unfold’s
UnfoldShape(Decompose/Optional/Iterable) →Shape.
N is the per-Optional-layer payload: () for the language-agnostic
engines, an adapter type (e.g. jnigen’s NullableKind) where the layer
needs to remember how null is represented over the wire.
Enums§
- Shape
- A base leaf wrapped in zero or more
Optional/Iterablelayers, from the inside out.Nis the payload eachOptionallayer carries.
Functions§
- fold_
shape - Bottom-up fold over the layer stack: compute the leaf value with
on_base, then applyon_optional/on_iterablefor each wrapping layer from the inside out.on_optionalalso receives the layer’s payload&Nand theShapeit wraps, so callers can special-case e.g. a layer sitting directly over the leaf.