[−][src]Struct serde_reflection::Tracer
Structure to drive the tracing of Serde serialization and deserialization.
This typically aims at computing a Registry
.
Methods
impl Tracer
[src]
pub fn new(config: TracerConfig) -> Self
[src]
Start tracing deserialization.
pub fn trace_value<T: ?Sized>(
&mut self,
samples: &mut Samples,
value: &T
) -> Result<(Format, Value)> where
T: Serialize,
[src]
&mut self,
samples: &mut Samples,
value: &T
) -> Result<(Format, Value)> where
T: Serialize,
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 thetrace_type_*
methods.
pub fn trace_type_once<'de, T>(
&mut self,
samples: &'de Samples
) -> Result<(Format, T)> where
T: Deserialize<'de>,
[src]
&mut self,
samples: &'de Samples
) -> Result<(Format, T)> where
T: Deserialize<'de>,
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.
pub fn trace_type_once_with_seed<'de, S>(
&mut self,
samples: &'de Samples,
seed: S
) -> Result<(Format, S::Value)> where
S: DeserializeSeed<'de>,
[src]
&mut self,
samples: &'de Samples,
seed: S
) -> Result<(Format, S::Value)> where
S: DeserializeSeed<'de>,
Same as trace_type_once
for seeded deserialization.
pub fn trace_type<'de, T>(
&mut self,
samples: &'de Samples
) -> Result<(Format, Vec<T>)> where
T: Deserialize<'de>,
[src]
&mut self,
samples: &'de Samples
) -> Result<(Format, Vec<T>)> where
T: Deserialize<'de>,
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.
pub fn trace_type_with_seed<'de, S>(
&mut self,
samples: &'de Samples,
seed: S
) -> Result<(Format, Vec<S::Value>)> where
S: DeserializeSeed<'de> + Clone,
[src]
&mut self,
samples: &'de Samples,
seed: S
) -> Result<(Format, Vec<S::Value>)> where
S: DeserializeSeed<'de> + Clone,
Same as trace_type
for seeded deserialization.
pub fn registry(self) -> Result<Registry>
[src]
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.
pub fn registry_unchecked(self) -> Registry
[src]
Same as registry but always return a value, even if we detected issues. This should only be use for debugging.
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Tracer
impl !Send for Tracer
impl !Sync for Tracer
impl Unpin for Tracer
impl !UnwindSafe for Tracer
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,