Struct TaggedTupleStructAccess

Source
struct TaggedTupleStructAccess<'der, 'a, 'de> {
    parent: &'der mut Deserializer<'a, 'de>,
    product: Product,
    entries: SmallVec<[(u8, &'de [u8]); 4]>,
    next_position: usize,
}
Expand description

SeqAccess adapter for top-level tuple structs (multi-element struct Pair(u32, bool) shapes). Decoded by tag, not by wire order: every wire entry is buffered as (tag, value-bytes) upfront, and on each next_element_seed we look up the tag corresponding to the current source position via Product.tag_for("0"), tag_for("1"), … and re-deserialize the matching entry’s bytes through a freshly constructed sub-wrapper (so any nested tagged types still see this wrapper’s interception).

This is what makes the deserializer robust to wire-order changes on the serializer side: if the serializer is fixed to emit tag-ascending (matching the design doc) — or some other order — we don’t need to touch this code, because we route by tag.

Buffering. value-bytes is captured by snapshotting the inner reader’s &[u8] before and after each IgnoredAny::deserialize walk (which advances exactly one msgpack value worth of bytes). Slicing the diff out of the original buffer gives us the exact byte range for that one value. The captured slice is &'de [u8] — same underlying buffer, no copy.

Inline capacity. SmallVec<[_; 4]> covers the typical tuple- struct arity (current ACIR/Brillig types use exclusively newtypes; our test fixtures top out at 3-element tuple structs) without a heap allocation. Anything larger transparently spills.

Fields§

§parent: &'der mut Deserializer<'a, 'de>§product: Product§entries: SmallVec<[(u8, &'de [u8]); 4]>

Buffered (tag, value-bytes) pairs in wire arrival order. We look these up by tag in next_element_seed; insertion order doesn’t matter.

§next_position: usize

Trait Implementations§

Source§

impl<'de, 'der, 'a> SeqAccess<'de> for TaggedTupleStructAccess<'der, 'a, 'de>

Source§

type Error = Error

The error type that can be returned if some error occurs during deserialization.
Source§

fn next_element_seed<T>( &mut self, seed: T, ) -> Result<Option<T::Value>, Self::Error>
where T: DeserializeSeed<'de>,

This returns Ok(Some(value)) for the next value in the sequence, or Ok(None) if there are no more remaining items. Read more
Source§

fn size_hint(&self) -> Option<usize>

Returns the number of elements remaining in the sequence, if known.
Source§

fn next_element<T>(&mut self) -> Result<Option<T>, Self::Error>
where T: Deserialize<'de>,

This returns Ok(Some(value)) for the next value in the sequence, or Ok(None) if there are no more remaining items. Read more

Auto Trait Implementations§

§

impl<'der, 'a, 'de> Freeze for TaggedTupleStructAccess<'der, 'a, 'de>

§

impl<'der, 'a, 'de> RefUnwindSafe for TaggedTupleStructAccess<'der, 'a, 'de>

§

impl<'der, 'a, 'de> Send for TaggedTupleStructAccess<'der, 'a, 'de>

§

impl<'der, 'a, 'de> Sync for TaggedTupleStructAccess<'der, 'a, 'de>

§

impl<'der, 'a, 'de> Unpin for TaggedTupleStructAccess<'der, 'a, 'de>

§

impl<'der, 'a, 'de> !UnwindSafe for TaggedTupleStructAccess<'der, 'a, 'de>

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.