Struct TaggedSerializeViaParent

Source
pub struct TaggedSerializeViaParent<'ser, 'a, W: Write> {
    parent: &'ser mut Serializer<'a, W>,
}
Expand description

Stateless pass-through adapter shared by every shape whose only job is to route element/key/value calls back through the parent Serializer. The msgpack header (array length or map length) is written upfront in the corresponding serialize_* method before the adapter is constructed; from there each entry is just one or two more values appended to the writer through the wrapper, so any tagged value nested inside still gets the int-keyed-map treatment.

Used as SerializeSeq (e.g. Vec<T>), SerializeTuple (fixed-length Rust tuples), and SerializeMap (e.g. BTreeMap<K, V>). Struct shapes have their own adapter (TaggedSerializeProduct) because they carry the Product needed to translate field names into integer tags.

Fields§

§parent: &'ser mut Serializer<'a, W>

Trait Implementations§

Source§

impl<'ser, 'a, W: Write> SerializeMap for TaggedSerializeViaParent<'ser, 'a, W>

Free-form maps (BTreeMap<K, V> and friends). Both keys and values are routed through the parent. Routing keys is mostly a no-op for the common primitive-key case (the wrapper forwards primitives to inner verbatim), but it keeps the door open for tagged keys without a special case here.

Source§

type Ok = ()

Must match the Ok type of our Serializer.
Source§

type Error = Error

Must match the Error type of our Serializer.
Source§

fn serialize_key<T>(&mut self, key: &T) -> Result<(), Self::Error>
where T: ?Sized + Serialize,

Serialize a map key. Read more
Source§

fn serialize_value<T>(&mut self, value: &T) -> Result<(), Self::Error>
where T: ?Sized + Serialize,

Serialize a map value. Read more
Source§

fn end(self) -> Result<Self::Ok, Self::Error>

Finish serializing a map.
Source§

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

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

impl<'ser, 'a, W: Write> SerializeSeq for TaggedSerializeViaParent<'ser, 'a, W>

Variable-length sequences (Vec<T>, &[T], …). Each element recurses through the parent so tagged elements stay int-keyed.

Source§

type Ok = ()

Must match the Ok type of our Serializer.
Source§

type Error = Error

Must match the Error type of our Serializer.
Source§

fn serialize_element<T>(&mut self, value: &T) -> Result<(), Self::Error>
where T: ?Sized + Serialize,

Serialize a sequence element.
Source§

fn end(self) -> Result<Self::Ok, Self::Error>

Finish serializing a sequence.
Source§

impl<'ser, 'a, W: Write> SerializeTuple for TaggedSerializeViaParent<'ser, 'a, W>

Fixed-length Rust tuples ((A, B), (A, B, C), …). Same wire shape as a sequence — msgpack has one length-prefixed array, regardless of whether the source was variable- or fixed-length on the Rust side.

Source§

type Ok = ()

Must match the Ok type of our Serializer.
Source§

type Error = Error

Must match the Error type of our Serializer.
Source§

fn serialize_element<T>(&mut self, value: &T) -> Result<(), Self::Error>
where T: ?Sized + Serialize,

Serialize a tuple element.
Source§

fn end(self) -> Result<Self::Ok, Self::Error>

Finish serializing a tuple.

Auto Trait Implementations§

§

impl<'ser, 'a, W> Freeze for TaggedSerializeViaParent<'ser, 'a, W>

§

impl<'ser, 'a, W> RefUnwindSafe for TaggedSerializeViaParent<'ser, 'a, W>
where W: RefUnwindSafe,

§

impl<'ser, 'a, W> Send for TaggedSerializeViaParent<'ser, 'a, W>
where W: Send,

§

impl<'ser, 'a, W> Sync for TaggedSerializeViaParent<'ser, 'a, W>
where W: Sync,

§

impl<'ser, 'a, W> Unpin for TaggedSerializeViaParent<'ser, 'a, W>

§

impl<'ser, 'a, W> !UnwindSafe for TaggedSerializeViaParent<'ser, 'a, W>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.