#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

Apache-2.0

3MB
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

Library

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:

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

Install

cargo install daml-codegen

Usage

USAGE:
    daml-codegen [OPTIONS] <dar>

ARGS:
    <dar>    Sets the input Dar file to use

OPTIONS:
    -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

Example

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

License

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

Dependencies

~6–9.5MB
~163K SLoC