Expand description
A type that can be decoded from CBOR.
Decode a value using the given Decoder
.
In addition to the decoder a user provided decoding context is given
as another parameter. Most implementations of this trait do not need
a decoding context and should be completely generic in the context
type. In cases where a context is needed and the Decode
impl type is
meant to be combined with other types that require a different context
type, it is preferrable to constrain the context type variable C
with
a trait bound instead of fixing the type.
If possible, return a nil value of Self
.
This method is primarily used by minicbor-derive
and allows
creating a special value denoting the absence of a “real” value if
no CBOR value is present. The canonical example of a type where
this is sensible is the Option
type, whose Decode::nil
method
would return Some(None)
.
With the exception of Option<_>
all types T
are considered
mandatory by default, i.e. T::nil()
returns None
. Missing values
of T
therefore cause decoding errors in derived Decode
implementations.
NB: A type implementing Decode
with an overriden Decode::nil
method should also override Encode::is_nil
if it implements Encode
at all.
sourceimpl<'b, Ctx, A: Decode<'b, Ctx>, B: Decode<'b, Ctx>, C: Decode<'b, Ctx>> Decode<'b, Ctx> for (A, B, C)
sourceimpl<'b, Ctx, A: Decode<'b, Ctx>, B: Decode<'b, Ctx>, C: Decode<'b, Ctx>, D: Decode<'b, Ctx>> Decode<'b, Ctx> for (A, B, C, D)
sourceimpl<'b, Ctx, A: Decode<'b, Ctx>, B: Decode<'b, Ctx>, C: Decode<'b, Ctx>, D: Decode<'b, Ctx>, E: Decode<'b, Ctx>> Decode<'b, Ctx> for (A, B, C, D, E)
sourceimpl<'b, Ctx, A: Decode<'b, Ctx>, B: Decode<'b, Ctx>, C: Decode<'b, Ctx>, D: Decode<'b, Ctx>, E: Decode<'b, Ctx>, F: Decode<'b, Ctx>> Decode<'b, Ctx> for (A, B, C, D, E, F)
sourceimpl<'b, Ctx, A: Decode<'b, Ctx>, B: Decode<'b, Ctx>, C: Decode<'b, Ctx>, D: Decode<'b, Ctx>, E: Decode<'b, Ctx>, F: Decode<'b, Ctx>, G: Decode<'b, Ctx>> Decode<'b, Ctx> for (A, B, C, D, E, F, G)
sourceimpl<'b, Ctx, A: Decode<'b, Ctx>, B: Decode<'b, Ctx>, C: Decode<'b, Ctx>, D: Decode<'b, Ctx>, E: Decode<'b, Ctx>, F: Decode<'b, Ctx>, G: Decode<'b, Ctx>, H: Decode<'b, Ctx>> Decode<'b, Ctx> for (A, B, C, D, E, F, G, H)
sourceimpl<'b, Ctx, A: Decode<'b, Ctx>, B: Decode<'b, Ctx>, C: Decode<'b, Ctx>, D: Decode<'b, Ctx>, E: Decode<'b, Ctx>, F: Decode<'b, Ctx>, G: Decode<'b, Ctx>, H: Decode<'b, Ctx>, I: Decode<'b, Ctx>> Decode<'b, Ctx> for (A, B, C, D, E, F, G, H, I)
sourceimpl<'b, Ctx, A: Decode<'b, Ctx>, B: Decode<'b, Ctx>, C: Decode<'b, Ctx>, D: Decode<'b, Ctx>, E: Decode<'b, Ctx>, F: Decode<'b, Ctx>, G: Decode<'b, Ctx>, H: Decode<'b, Ctx>, I: Decode<'b, Ctx>, J: Decode<'b, Ctx>> Decode<'b, Ctx> for (A, B, C, D, E, F, G, H, I, J)
sourceimpl<'b, Ctx, A: Decode<'b, Ctx>, B: Decode<'b, Ctx>, C: Decode<'b, Ctx>, D: Decode<'b, Ctx>, E: Decode<'b, Ctx>, F: Decode<'b, Ctx>, G: Decode<'b, Ctx>, H: Decode<'b, Ctx>, I: Decode<'b, Ctx>, J: Decode<'b, Ctx>, K: Decode<'b, Ctx>> Decode<'b, Ctx> for (A, B, C, D, E, F, G, H, I, J, K)
sourceimpl<'b, Ctx, A: Decode<'b, Ctx>, B: Decode<'b, Ctx>, C: Decode<'b, Ctx>, D: Decode<'b, Ctx>, E: Decode<'b, Ctx>, F: Decode<'b, Ctx>, G: Decode<'b, Ctx>, H: Decode<'b, Ctx>, I: Decode<'b, Ctx>, J: Decode<'b, Ctx>, K: Decode<'b, Ctx>, L: Decode<'b, Ctx>> Decode<'b, Ctx> for (A, B, C, D, E, F, G, H, I, J, K, L)
sourceimpl<'b, Ctx, A: Decode<'b, Ctx>, B: Decode<'b, Ctx>, C: Decode<'b, Ctx>, D: Decode<'b, Ctx>, E: Decode<'b, Ctx>, F: Decode<'b, Ctx>, G: Decode<'b, Ctx>, H: Decode<'b, Ctx>, I: Decode<'b, Ctx>, J: Decode<'b, Ctx>, K: Decode<'b, Ctx>, L: Decode<'b, Ctx>, M: Decode<'b, Ctx>> Decode<'b, Ctx> for (A, B, C, D, E, F, G, H, I, J, K, L, M)
sourceimpl<'b, Ctx, A: Decode<'b, Ctx>, B: Decode<'b, Ctx>, C: Decode<'b, Ctx>, D: Decode<'b, Ctx>, E: Decode<'b, Ctx>, F: Decode<'b, Ctx>, G: Decode<'b, Ctx>, H: Decode<'b, Ctx>, I: Decode<'b, Ctx>, J: Decode<'b, Ctx>, K: Decode<'b, Ctx>, L: Decode<'b, Ctx>, M: Decode<'b, Ctx>, N: Decode<'b, Ctx>> Decode<'b, Ctx> for (A, B, C, D, E, F, G, H, I, J, K, L, M, N)
sourceimpl<'b, Ctx, A: Decode<'b, Ctx>, B: Decode<'b, Ctx>, C: Decode<'b, Ctx>, D: Decode<'b, Ctx>, E: Decode<'b, Ctx>, F: Decode<'b, Ctx>, G: Decode<'b, Ctx>, H: Decode<'b, Ctx>, I: Decode<'b, Ctx>, J: Decode<'b, Ctx>, K: Decode<'b, Ctx>, L: Decode<'b, Ctx>, M: Decode<'b, Ctx>, N: Decode<'b, Ctx>, O: Decode<'b, Ctx>> Decode<'b, Ctx> for (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O)
sourceimpl<'b, Ctx, A: Decode<'b, Ctx>, B: Decode<'b, Ctx>, C: Decode<'b, Ctx>, D: Decode<'b, Ctx>, E: Decode<'b, Ctx>, F: Decode<'b, Ctx>, G: Decode<'b, Ctx>, H: Decode<'b, Ctx>, I: Decode<'b, Ctx>, J: Decode<'b, Ctx>, K: Decode<'b, Ctx>, L: Decode<'b, Ctx>, M: Decode<'b, Ctx>, N: Decode<'b, Ctx>, O: Decode<'b, Ctx>, P: Decode<'b, Ctx>> Decode<'b, Ctx> for (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P)