Struct serde_reflection::Tracer[][src]

pub struct Tracer { /* fields omitted */ }
Expand description

Structure to drive the tracing of Serde serialization and deserialization. This typically aims at computing a Registry.

Implementations

Start tracing deserialization.

Trace the serialization of a particular value.

  • Nested containers will be added to the tracing registry, indexed by their (non-qualified) name.
  • Sampled Rust values will be inserted into samples to benefit future calls to the trace_type_* methods.

Trace a single deserialization of a particular type.

  • Nested containers will be added to the tracing registry, indexed by their (non-qualified) name.
  • As a byproduct of deserialization, we also return a value of type T.
  • Tracing deserialization of a type may fail if this type or some dependencies have implemented a custom deserializer that validates data. The solution is to make sure that samples holds enough sampled Rust values to cover all the custom types.

Same as trace_type_once for seeded deserialization.

Same as trace_type_once but if T is an enum, we repeat the process until all variants of T are covered. We accumulate and return all the sampled values at the end.

Trace a type T that is simple enough that no samples of values are needed.

  • If T is an enum, the tracing iterates until all variants of T are covered.
  • Accumulate and return all the sampled values at the end. This is merely a shortcut for self.trace_type with a fixed empty set of samples.

Same as trace_type for seeded deserialization.

Finish tracing and recover a map of normalized formats. Returns an error if we detect incompletely traced types. This may happen in a few of cases:

  • We traced serialization of user-provided values but we are still missing the content of an option type, the content of a sequence type, the key or the value of a dictionary type.
  • We traced deserialization of an enum type but we detect that some enum variants are still missing.

Same as registry but always return a value, even if we detected issues. This should only be use for debugging.

Trait Implementations

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.