Crate glean_build

source ·
Expand description

Glean Rust build utility

glean-build generates the Rust bindings based on metrics and ping definitions, using glean-parser under the hood.

§Requirements

  • Python 3
  • pip

§Usage

In your application add a build.rs file next to your Cargo.toml, then add this code:

use glean_build::Builder;

fn main() {
    Builder::default()
        .file("metrics.yaml")
        .generate()
        .expect("Error generating Glean Rust bindings");
}

In your code add the following to include the generated code:

mod metrics {
    include!(concat!(env!("OUT_DIR"), "/glean_metrics.rs"));
}

You can then access your metrics and pings directly by name within the metrics module.

Structs§

  • A Glean Rust bindings generator.