#ledger #daml #api

bin+lib daml-codegen

Daml GRPC Ledger API Code Generator

5 releases

0.2.2 Mar 8, 2022
0.2.1 Mar 7, 2022
0.2.0 Mar 4, 2022
0.1.1 Mar 3, 2022
0.1.0 Mar 1, 2022

#2191 in Development tools

36 downloads per month
Used in 2 crates


11K SLoC

Documentation Crate maintenance-status

Daml Codegen

A library and a tool for generating Rust types from daml code.

This crate provides:

  • A code generator backend for the of custom attributes and procedural macros defined in the daml-derive crate
  • A daml_codegen function which is designed to be used from build.rs files
  • A standalone codegen cli tool


This crate should not be used directly when used as a library, instead you should depend on the daml crate and enable the codegen feature:

daml = { version = "0.2.2", features = [ "codegen" ] }


cargo install daml-codegen


    daml-codegen [OPTIONS] <dar>

    <dar>    Sets the input Dar file to use

    -c, --combine-modules              Combine modules as a single file
    -f, --module-filter <filter>...    Sets the regex module filter to apply
    -h, --help                         Print help information
    -i, --render-intermediate          Generate intermediate types
    -o, --output-dir <output>          Sets the output path
    -v, --verbose                      Sets the level of verbosity
    -V, --version                      Print version information


To generate Rust types from Daml dar MyModel.dar in single src file /tmp/my_model_0_1_0.rs:

daml-codegen MyModel.dar --combine-modules -o /tmp/MyModel.dar


daml-codegen is distributed under the terms of the Apache License (Version 2.0).

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in time by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

See LICENSE for details.

Copyright 2022


~163K SLoC