To ensure the API is stable across Rust consumers and re-exporters (like FOG),
you must define a trait for the new metric in
First, add your metric type to
mod counter; pub use self::counter::Counter;
Then add the trait in e.g.
The trait includes
and any metric operation included in the metric type's API
The idea here is to only include operations that make sense for Rust consumers.
If there are internal-only or language-specific APIs on the underlying metric,
feel free to not include them on the trait.
Spend some time on the comments. These will be the dev-facing API docs for Rust consumers.
The Rust Language Binding can simply re-export the core metric types.
You can find the RLB metric re-exports in
Add your metric type to
pub use glean_core::Counter;
Don't forget to document the new Rust API in the Book's page on the Metric Type (e.g. Counter). Add a tab for Rust, and mimic any other language's example.