Struct rmp_serde::encode::MaybeUnknownLengthCompound[][src]

pub struct MaybeUnknownLengthCompound<'a, W: 'a, C: 'a> { /* fields omitted */ }
Expand description

Contains a Serializer for encoding elements of sequences and maps.

Note

If , for example, a field inside a struct is tagged with #serde(flatten) the total number of fields of this struct will be unknown to serde because flattened fields may have name clashes and then will be overwritten. So, serde wants to serialize the struct as a map with an unknown length.

For the described case a UnknownLengthCompound is used to encode the elements. On end() the counted length and the encoded elements will be written to the Serializer. A caveat is, that structs that contain flattened fields arem always written as a map, even when compact representaion is desired.

Otherwise, if the length is known, the elements will be encoded directly by the Serializer.

Trait Implementations

Formats the value using the given formatter. Read more

Must match the Ok type of our Serializer.

Must match the Error type of our Serializer.

Serialize a map key. Read more

Serialize a map value. Read more

Finish serializing a map.

fn serialize_entry<K, V>(
    &mut self,
    key: &K,
    value: &V
) -> Result<(), Self::Error> where
    V: Serialize + ?Sized,
    K: Serialize + ?Sized
[src]

Serialize a map entry consisting of a key and a value. Read more

Must match the Ok type of our Serializer.

Must match the Error type of our Serializer.

Serialize a sequence element.

Finish serializing a sequence.

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.