[][src]Module tracers_codegen::proc_macros

This module is where the implementation of the probe-related proc macros are. The actual proc macro is in the tracers-macros crate because proc macro crates can only export proc macros and nothing else. That's an inconvenient restriction, especially since there's quite a lot of overlap between the macro code and the build-time probe code generation logic. Hence, this bifurcation.

Functions

init_provider_impl
probe_impl

Translates what looks to be an explicit call to the associated function corresponding to a probe on a provider trait, into something which at runtime will most efficiently attempt to access the global static instance of the probe and, if it's enabled, evaluate the args and fire the probe.

report_error

Uses the syn library's Error struct to report an error in the form of a TokenStream, so that a proc macro can insert this token stream into its output and thereby report a detailed error message to the user.

tracer_impl

Actual implementation of the macro logic, factored out of the proc macro itself so that it's more testable