Skip to main content

TraceField

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>

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,

Encode this field’s value into the event encoder.

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

Whether this field is optional on the wire (high-bit modifier).

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".

Implementations on Foreign Types§

§

impl TraceField for bool

§

type Ref<'a> = bool

§

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<<bool as TraceField>::Ref<'a>>

§

impl TraceField for f64

§

type Ref<'a> = f64

§

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<<f64 as TraceField>::Ref<'a>>

§

impl TraceField for i64

§

type Ref<'a> = i64

§

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<<i64 as TraceField>::Ref<'a>>

§

impl TraceField for u8

§

type Ref<'a> = u8

§

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<<u8 as TraceField>::Ref<'a>>

§

impl TraceField for u16

§

type Ref<'a> = u16

§

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<<u16 as TraceField>::Ref<'a>>

§

impl TraceField for u32

§

type Ref<'a> = u32

§

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<<u32 as TraceField>::Ref<'a>>

§

impl TraceField for u64

§

type Ref<'a> = u64

§

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<<u64 as TraceField>::Ref<'a>>

Implementors§

§

impl TraceField for ApplicationProtocol

§

type Ref<'a> = &'a [u8]

§

impl TraceField for BridgeCloseReason

§

impl TraceField for CpuSampleSource

§

impl TraceField for Domain

§

type Ref<'a> = &'a str

§

impl TraceField for Host

§

type Ref<'a> = &'a str

§

impl TraceField for InternedStackFrames

§

impl TraceField for InternedString

§

impl TraceField for rama::tls::boring::dial9::MaybeAlpnSelected

§

type Ref<'a> = &'a [u8]

§

impl TraceField for rama::tls::rustls::dial9::MaybeAlpnSelected

§

type Ref<'a> = &'a [u8]

§

impl TraceField for MaybeServerName

§

type Ref<'a> = &'a str

§

impl TraceField for Option<InternedStackFrames>

§

impl TraceField for Option<InternedString>

§

type Ref<'a> = Option<<InternedString as TraceField>::Ref<'a>>

§

impl TraceField for Option<StackFrames>

§

type Ref<'a> = Option<<StackFrames as TraceField>::Ref<'a>>

§

impl TraceField for Option<String>

§

type Ref<'a> = Option<<String as TraceField>::Ref<'a>>

§

impl TraceField for Option<Vec<(String, String)>>

§

type Ref<'a> = Option<<Vec<(String, String)> as TraceField>::Ref<'a>>

§

impl TraceField for Option<Vec<u8>>

§

type Ref<'a> = Option<<Vec<u8> as TraceField>::Ref<'a>>

§

impl TraceField for Option<bool>

§

type Ref<'a> = Option<<bool as TraceField>::Ref<'a>>

§

impl TraceField for Option<f64>

§

type Ref<'a> = Option<<f64 as TraceField>::Ref<'a>>

§

impl TraceField for Option<i64>

§

type Ref<'a> = Option<<i64 as TraceField>::Ref<'a>>

§

impl TraceField for Option<u8>

§

type Ref<'a> = Option<<u8 as TraceField>::Ref<'a>>

§

impl TraceField for Option<u16>

§

type Ref<'a> = Option<<u16 as TraceField>::Ref<'a>>

§

impl TraceField for Option<u32>

§

type Ref<'a> = Option<<u32 as TraceField>::Ref<'a>>

§

impl TraceField for Option<u64>

§

type Ref<'a> = Option<<u64 as TraceField>::Ref<'a>>

§

impl TraceField for ProtocolVersion

§

impl TraceField for StackFrames

§

type Ref<'a> = StackFramesRef<'a>

§

impl TraceField for String

§

type Ref<'a> = &'a str

§

impl TraceField for TaskId

§

type Ref<'a> = TaskId

§

impl TraceField for Vec<(String, String)>

§

type Ref<'a> = StringMapRef<'a>

§

impl TraceField for Vec<u8>

§

type Ref<'a> = &'a [u8]

§

impl TraceField for WorkerId

§

type Ref<'a> = WorkerId