musli_core/de/decode_trace.rs
1use super::Decoder;
2
3/// Trait governing how types are decoded specifically for tracing.
4///
5/// This is used for types where some extra bounds might be necessary to trace a
6/// container such as a [`HashMap<K, V>`] where `K` would have to implement
7/// [`fmt::Display`].
8///
9/// [`HashMap<K, V>`]: std::collections::HashMap
10/// [`fmt::Display`]: std::fmt::Display
11pub trait DecodeTrace<'de, M>: Sized {
12 /// Decode the given input.
13 fn trace_decode<D>(cx: &D::Cx, decoder: D) -> Result<Self, D::Error>
14 where
15 D: Decoder<'de, Mode = M>;
16}