pub trait EventSchema:
Send
+ Sync
+ Sized
+ 'static {
const FULL_NAME: &'static str;
const TIER: Tier;
const DEFAULT_SEV: Severity;
const FIELDS: &'static [FieldMeta];
const SCHEMA_HASH: u64;
const SPANS_PAIRED_WITH: Option<&'static str> = None;
// Required methods
fn encode_payload(&self, buf: &mut BytesMut);
fn project(&self, env: &mut ObsEnvelope);
// Provided method
fn project_metrics(&self, sink: &mut dyn MetricEmitter) { ... }
}Expand description
Trait implemented by every Obs* event type.
Codegen emits one impl per .proto message or #[derive(Event)]
struct. Sinks consume the object-safe sibling
crate::registry::EventSchemaErased; this trait is for the
monomorphised emit path.
Required Associated Constants§
Sourceconst DEFAULT_SEV: Severity
const DEFAULT_SEV: Severity
Default severity the schema declares.
Sourceconst SCHEMA_HASH: u64
const SCHEMA_HASH: u64
First 8 bytes of BLAKE3 over the canonical descriptor; baked at build time. See spec 10 § 6 + spec 12 § 3.5.
Provided Associated Constants§
Sourceconst SPANS_PAIRED_WITH: Option<&'static str> = None
const SPANS_PAIRED_WITH: Option<&'static str> = None
When this event participates in a Started/Completed pair, the
schema’s full name of its sibling event. The OTLP trace sink
matches paired events on this constant rather than suffix
sniffing. Schemas that are not paired return None.
Spec 20 § 2.5 B / spec 93 P1-7.
Required Methods§
Sourcefn encode_payload(&self, buf: &mut BytesMut)
fn encode_payload(&self, buf: &mut BytesMut)
Encode this event’s payload using buffa’s encoder into a reused
buffer. The codegen impl forwards to buffa::Message::encode.
Sourcefn project(&self, env: &mut ObsEnvelope)
fn project(&self, env: &mut ObsEnvelope)
Project labels and lift trace/span ids onto the envelope. Generated; never hand-written. See spec 11 pipeline § 4.1.
Provided Methods§
Sourcefn project_metrics(&self, sink: &mut dyn MetricEmitter)
fn project_metrics(&self, sink: &mut dyn MetricEmitter)
For MEASUREMENT-annotated fields, emit metric data points.
Phase-1 default impl is a no-op so MEASUREMENT-bearing schemas
authored in Phase 1 do not error in metric sinks; Phase 2
codegen overrides this. Spec 12 § 3.2.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".