pub trait StableEnumTrace: Sized + Serialize {
const STABLE_VARIANTS: &'static [(&'static str, u32)];
// Required method
fn trace_all_variants(
tracer: &mut Tracer,
samples: &Samples,
) -> Result<Format>;
}Expand description
Companion trait of StableEnum: exposes each variant’s stable tag and
provides the implementation backing
TracerExt::trace_stable_enum_type. Implemented by the
#[derive(StableEnum)] macro.
The derive auto-generates trace_all_variants by calling
Tracer::trace_type_once for each field type to obtain a sample value,
then Tracer::trace_value to record the variant. As a result, every
field type must implement serde::de::DeserializeOwned (or otherwise be
traceable by Tracer::trace_type_once). Nested StableEnum fields are
not supported automatically — pre-trace them with
trace_stable_enum_type::<NestedEnum> first.
Required Associated Constants§
Sourceconst STABLE_VARIANTS: &'static [(&'static str, u32)]
const STABLE_VARIANTS: &'static [(&'static str, u32)]
The (variant_name, variant_tag) pairs in declaration order.
Required Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.