Skip to main content

StableEnumTrace

Trait StableEnumTrace 

Source
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§

Source

const STABLE_VARIANTS: &'static [(&'static str, u32)]

The (variant_name, variant_tag) pairs in declaration order.

Required Methods§

Source

fn trace_all_variants(tracer: &mut Tracer, samples: &Samples) -> Result<Format>

Trace each variant of Self into tracer’s registry. The default derive implementation is sufficient for most cases.

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.

Implementors§

Source§

impl StableEnumTrace for Operation

Available on non-WebAssembly only.
Source§

const STABLE_VARIANTS: &'static [(&'static str, u32)]

Source§

impl StableEnumTrace for FungibleOperation

Available on non-WebAssembly only.
Source§

const STABLE_VARIANTS: &'static [(&'static str, u32)]

Source§

impl StableEnumTrace for linera_sdk::abis::fungible::FungibleResponse

Available on non-WebAssembly only.
Source§

const STABLE_VARIANTS: &'static [(&'static str, u32)]

Source§

impl StableEnumTrace for linera_sdk::abis::wrapped_fungible::FungibleResponse

Available on non-WebAssembly only.
Source§

const STABLE_VARIANTS: &'static [(&'static str, u32)]

Source§

impl StableEnumTrace for WrappedFungibleOperation

Available on non-WebAssembly only.
Source§

const STABLE_VARIANTS: &'static [(&'static str, u32)]