Skip to main content

TraceIdLike

Trait TraceIdLike 

Source
pub trait TraceIdLike: Eq {
    // Required method
    fn to_u128(&self) -> u128;
}
Expand description

A trait for converting trace IDs to a numeric representation.

Provides a common interface for converting trace IDs from different tracing systems into a 128-bit unsigned integer for use in hash-based operations.

§Examples

use libdd_sampling::TraceIdLike;

#[derive(Clone, PartialEq, Eq)]
struct MyTraceId(u128);

impl TraceIdLike for MyTraceId {
    fn to_u128(&self) -> u128 {
        self.0
    }
}

Required Methods§

Source

fn to_u128(&self) -> u128

Converts the trace ID to a 128-bit unsigned integer.

The conversion should be deterministic: the same trace ID must always produce the same u128 value. Typically implemented by interpreting the trace ID’s bytes as a big-endian integer.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§