nagisa / rust_tracy_client

Tracy client libraries for Rust
Apache License 2.0
170 stars 36 forks source link

Define custom source location for spans #108

Open Dinnerbone opened 2 months ago

Dinnerbone commented 2 months ago

We have a bunch of code that's generated by another language, and a build script creates the rust bindings for every method defined in the other language. It'd be really nice to be able to generate a span_location!() for each method, pointing to the true original source and line number, rather than it just assuming that file!()/line!() works.

The easiest would probably just be adding those as extra values to the macro, e.g. span_location!(name, function, file, loc), but anything that works at compile time works for us. It'd get generated and stored in a giant pub const FUNCTIONS = .....

nagisa commented 2 months ago

PR welcome.