Skip to content

Easy reflection type traversal utils #14847

@DasLixou

Description

@DasLixou

What problem does this solve or what need does it fill?

Currently, it is non-trivial to search for and patch a specific type nested deep inside a dyn Reflect.

What solution would you like?

Add an iter_children (name bikesheddable) iterator function on Reflect that returns a ChildrenIter (name bikesheddable) over all direct children. ChildrenIter will be an enum with the same same variants as ReflectKind, but it also holds a reference to the iterator of the erased data trait.
e.g. Struct(IterFields<'a>)
This is needed for Reflect to still be object-safe.
It should also exist an iter_children_mut, which is blocked on #14846

What alternative(s) have you considered?

Writing that myself.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-ReflectionRuntime information about typesC-FeatureA new feature, making something new possibleD-ComplexQuite challenging from either a design or technical perspective. Ask for help!

    Type

    No type

    Projects

    Status

    Open

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions