Skip to main content

Module transform

Module transform 

Source
Expand description

User-extensible IR transforms with a minimal s-expr script surface. User-extensible IR transforms.

A Transform<T> is an endomorphism — it takes a T and returns a modified T. This is how a user extends the pipeline without recompiling the core: they declare transforms as data (or script them in a minimal s-expr surface), stack them, and slot them into the generation pipeline before the backend runs.

Transforms compose: ComposeTransforms(a, b).apply(x) == b.apply(a.apply(x)). Identity is the unit — useful as a default and as a sentinel.

The ops submodule provides a minimal, data-level operation enum (ResourceOp) covering the most common IR edits: add a tag, rename an attribute, set a description, flip a sensitivity flag. Users who need richer transforms can either add variants or implement their own Transform<IacResource> in Rust.

The script submodule (feature-gated, script feature) provides a tiny s-expression reader that compiles a script string into a Vec<ResourceOp>. That is the “embedded Lisp” surface of the pipeline — code-as-data parse, interpreted to structured ops. Sufficient for the usual extension cases; full scripting power can later slot in behind the same trait.

Modules§

ops
Data-level IR operations.
script
Minimal s-expression reader → Vec<ResourceOp>.

Structs§

ComposeTransforms
Sequential composition: apply a, then b.
Identity
Identity transform — returns its input unchanged.

Traits§

Transform
A structure-preserving mutation of a value.