Trait TraceField
pub trait TraceField {
type Ref<'a>;
// Required methods
fn field_type() -> FieldType;
fn encode<W>(&self, enc: &mut EventEncoder<'_, W>) -> Result<(), Error>
where W: Write;
fn decode_ref<'a>(val: &FieldValueRef<'a>) -> Option<Self::Ref<'a>>;
// Provided methods
fn is_optional() -> bool { ... }
fn decode_missing<'a>() -> Option<Self::Ref<'a>> { ... }
}Available on crate feature
dial9 only.Expand description
Trait for types that can be used as trace fields.
Provides schema metadata (field_type), encoding (encode), and
decoding (decode_ref).
Required Associated Types§
type Ref<'a>
type Ref<'a>
The zero-copy decoded form of this field.
Required Methods§
fn field_type() -> FieldType
fn encode<W>(&self, enc: &mut EventEncoder<'_, W>) -> Result<(), Error>where
W: Write,
fn encode<W>(&self, enc: &mut EventEncoder<'_, W>) -> Result<(), Error>where
W: Write,
Encode this field’s value into the event encoder.
fn decode_ref<'a>(val: &FieldValueRef<'a>) -> Option<Self::Ref<'a>>
fn decode_ref<'a>(val: &FieldValueRef<'a>) -> Option<Self::Ref<'a>>
Extract this field’s value from a zero-copy FieldValueRef.
Provided Methods§
fn is_optional() -> bool
fn is_optional() -> bool
Whether this field is optional on the wire (high-bit modifier).
fn decode_missing<'a>() -> Option<Self::Ref<'a>>
fn decode_missing<'a>() -> Option<Self::Ref<'a>>
Called when the field is absent from the wire data (not in the schema).
Returns None for required fields (decode failure) and Some(None) for
optional fields.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".