Skip to main content

Module codegen_helpers

Module codegen_helpers 

Source
Expand description

Auxiliary trait surface — the small set of cross-cutting traits the codegen and the bridge use to talk to the runtime without dragging the whole event type into every consumer. Spec 12 § 3.6.

  • BuildableTo — marker for typed-builder “all-required-set” state.
  • FieldCapture — visitor used by tracing→obs auto-typing to lift recorded fields into a typed event.
  • SpanCtx — read-only view of the active scope/span context that register_typed-style closures receive.
  • EnumCount — compile-time variant count, emitted by #[derive(EnumLabel)] so lint L005 can run without nightly.

MetricEmitter is defined in its own module (crate::metric); it belongs alongside the metric pipeline rather than the codegen support traits.

Structs§

FieldCapture
Visitor used by tracing’s Event::record(visitor) to extract typed values into a thread-local scratch space; reused across emissions (zero per-event allocation in the steady state). Spec 12 § 3.6.
SpanCtx
Read-only view of the active scope/span context that register_typed-style closures receive. Spec 12 § 3.6.
SpanFrame
One frame of the bridge-visible span ancestry. Borrowed; never owns span data. Spec 12 § 3.6.

Traits§

BuildableTo
Marker trait implemented by typed-builder’s “all-required-fields-set” builder state. The codegen emits a blanket impl over the parameter shape typed-builder produces, so .emit() only compiles when every required setter has been called. Spec 12 § 3.6.
EnumCount
Compile-time variant count for any enum used as a LABEL field. Generated by #[derive(EnumLabel)] and consulted by lint L005 so we do not depend on nightly’s variant_count. Spec 12 § 3.6.