Crate ink_codegen

source ·
Expand description

The ink! code generation.

This module defines everything the ink! procedural macro needs in order to generate Rust code for ink! smart contracts.

We avoid structuring things via hidden or private modules, this was the ink! v1 way of doing code generation and it was bug prone and hard to maintain.

What we do instead to generate code that is hidden from users is to pack it into anonymous const (so const _: () = { … };) and connect those to the outside world with private trait implementations.

You can see how the generated code looks by installing cargo-expand and executing cargo expand --manifest-path ./examples/flipper/Cargo.toml in this repository.

Traits

Types for which code can be generated by this crate.

Functions

Generates the entire code for the given ink! contract.