Macro tracy_client::register_demangler
source · macro_rules! register_demangler { () => { ... }; ($path:path) => { ... }; }
Available on crate feature
demangle
only.Expand description
Registers a custom demangler function.
A default implementation for demangling Rust symbols can be registered by passing no arguments.
Custom implementations can be registered by passing a function with the following signature:
fn(mangled: &str, buffer: &mut tracy_client::demangle::Buffer) -> std::fmt::Result
Custom demanglers:
- Must not write null bytes to the buffer.
- Returning
Err
or leaving the buffer unchanged will result in the symbol being displayed as-is.
See the module-level documentation for more information.
§Examples
use tracy_client::{demangle, register_demangler};
// Register the default demangler.
register_demangler!();
// Register a noop demangler.
register_demangler!(demangle::noop);
// Register a custom demangler.
register_demangler!(my_demangler);
fn my_demangler(s: &str, buffer: &mut demangle::Buffer) -> std::fmt::Result {
// Custom demangling logic...
use std::fmt::Write;
write!(buffer, "{s}")?;
Ok(())
}