Skip to main content

Module ir

Module ir 

Source
Expand description

A decoder-agnostic intermediate representation (IR) of Daml types.

The IR is the seam between “decode Daml-LF” (canton-lf) and “emit Rust” (this crate’s generator). Neither side knows about the other: a decoder produces this IR, the generator consumes it — so the LF-decoder choice stays isolated to lowering, the one step that reads the LF AST (lower_dar).

Structs§

Choice
A choice on a Template.
Crate
A whole generated crate: every package in a DAR, each as its own Rust module (so cross-module and cross-package references resolve, and names from different modules cannot collide).
Enum
An enumeration: named constructors that carry no payload.
Field
One field of a record.
Interface
A Daml interface: its view type and choices, plus the on-ledger identity a choice exercised through the interface needs. The marker struct itself is emitted from the interface’s DataCons::Interface data type; this adds the Interface/Choice impls on that marker.
Module
A module’s worth of generated declarations: its data types, templates, and interfaces.
NamedModule
A Daml module rendered as a Rust submodule.
PackageModule
One package rendered as a Rust module (pub mod <name> { … }), containing a submodule per Daml module.
Record
A record data type. Template payloads are records too, so this is reused for both a plain data … = … with record and a template … with payload.
Template
A template: its payload fields, its choices, and an optional contract key.
TypeRef
A reference to a named Daml data type, with any applied type arguments.
Variant
A variant (sum) type: named constructors, each optionally carrying a payload.
VariantConstructor
One constructor of a Variant.

Enums§

DamlType
A Daml type — a primitive, a container, or a reference to a named data type.
DataType
A named data type declared in a module: a record, a variant, or an enum.