Skip to main content

Module envelope

Module envelope 

Source
Expand description

Envelope construction and projection helpers.

Spec 10 § 6 defines the wire envelope (obs.v1.ObsEnvelope); this module provides the typed EventSchema trait that codegen targets, the Envelope newtype around the wire envelope (so tests can manipulate it without going through buffa), and the build_envelope / project helpers used by the emit hot path (spec 11 § 5).

Structs§

Envelope
Newtype wrapper around the wire ObsEnvelope so tests and downstream code don’t depend directly on the buffa-generated type’s Default + Clone shape (which is private to obs-proto’s codegen boundary).
FieldMeta
Compile-time field metadata emitted by codegen alongside each EventSchema impl. Mirrors the proto-side obs.v1.FieldMeta.

Enums§

FieldRole
Codegen-derived classification of a field. Decoupled from the FieldKind enum so codegen can stamp this from the descriptor without re-parsing.

Traits§

EventSchema
Trait implemented by every Obs* event type.

Functions§

build_envelope
Build an envelope for the given event using its declared default severity. The payload is encoded into a thread-local scratch buffer and copied into the envelope’s payload field; labels and lifted fields are still empty here — project() runs next on the emit path.
build_envelope_at
Like build_envelope but with a caller-specified severity (used by emit_at(sev)).