feat: introduce FieldNameIterator for field path traversal - #23
Merged
Conversation
- Add FieldNameIterator struct with domain-specific methods - Replace core::slice::Iter usage in FieldGetter trait - Implement From traits for easy creation from XPath and [String] - Update all FieldGetter implementations across gene and gene_derive - Add comprehensive documentation and examples
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR introduces
FieldNameIterator, a dedicated iterator type for traversing field names in XPath-like paths (e.g.,.parent.child.field). It replaces the previous use ofcore::slice::Iterthroughout the codebase, improving API clarity.Motivation
The previous implementation used
core::slice::Iter<'_, String>directly in theFieldGettertrait, which:FieldGettertypesChanges
FieldNameIterator<'f>struct with proper documentation and examplesFrom<&[String]>andFrom<&XPath>traits for easy creationnext_field_name(),is_terminal()FieldGetter::get_from_iter()signature to useFieldNameIteratorgeneandgene_derivecratesBreaking Changes
FieldGetter::get_from_iter()method signature changed fromcore::slice::Iter<'_, String>toFieldNameIterator<'_>FieldGettertraits will need to update their implementations