Skip to main content

follow_shredded_path_element

Function follow_shredded_path_element 

Source
pub(crate) fn follow_shredded_path_element<'a>(
    shredding_state: &BorrowedShreddingState<'a>,
    path_element: &VariantPathElement<'_>,
    _cast_options: &CastOptions<'_>,
) -> Result<ShreddedPathStep<'a>>
Expand description

Given a shredded variant field – a (value?, typed_value?) pair – try to take one path step deeper. For a VariantPathElement::Field, if there is no typed_value at this level, if typed_value is not a struct, or if the requested field name does not exist, traversal returns a missing-path step (Missing or NotShredded depending on whether value exists).

TODO: Support VariantPathElement::Index? It wouldn’t be easy, and maybe not even possible.