Skip to main content

Crate imping_build

Crate imping_build 

Source
Expand description

Generates Rust bindings from imping IR files, from a build script or the command line.

Builder reads the IR file of each build of the target, generates one set of bindings for them with imping-codegen and writes it. Failures are an Error naming the file involved.

§From a build script

// build.rs
fn main() -> Result<(), imping_build::Error> {
    imping_build::Builder::new()
        .ir("steam", "ir/target.json")
        .generate()
}

Each IR file gets a label, which names its build in the bindings: here target::Build::Steam and constants such as RVA_STEAM. For several builds, add an ir per build; see Several builds.

Builder::generate writes $OUT_DIR/imped.rs for the crate to include:

ⓘ
include!(concat!(env!("OUT_DIR"), "/imped.rs"));

§From the command line

With the cli feature, this crate also builds the imping tool:

cargo install --path crates/imping-build --features cli
imping generate --ir steam=ir/target.json -o src/imped.rs --module-name TargetCore.dll=target
imping generate --ir steam_2021=ir/2021.json --ir steam_2026=ir/2026.json -o src/imped.rs
imping generate --ir steam=ir/target.json --accept-build steam:target.exe=0x64b8f2a1:0xa3c000
imping check --ir steam=ir/target.json

Structs§

Builder
Generates one set of bindings from the IR files of one or more builds.

Enums§

Error
Why generating bindings failed.