Skip to content

feat: introduce FieldNameIterator for field path traversal - #23

Merged
qjerome merged 3 commits into
mainfrom
feat/field-name-iterator
Mar 6, 2026
Merged

feat: introduce FieldNameIterator for field path traversal#23
qjerome merged 3 commits into
mainfrom
feat/field-name-iterator

Conversation

@qjerome

@qjerome qjerome commented Mar 6, 2026

Copy link
Copy Markdown
Member

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 of core::slice::Iter throughout the codebase, improving API clarity.

Motivation
The previous implementation used core::slice::Iter<'_, String> directly in the FieldGetter trait, which:

  • Exposed internal implementation details
  • Lacked domain-specific methods for field traversal
  • Made the API less intuitive for users implementing custom FieldGetter types

Changes

  • Added FieldNameIterator<'f> struct with proper documentation and examples
  • Implemented From<&[String]> and From<&XPath> traits for easy creation
  • Added domain-specific methods: next_field_name(), is_terminal()
  • Updated FieldGetter::get_from_iter() signature to use FieldNameIterator
  • Refactored all implementations in gene and gene_derive crates
  • Updated examples and documentation throughout the codebase

Breaking Changes

  • FieldGetter::get_from_iter() method signature changed from core::slice::Iter<'_, String> to FieldNameIterator<'_>
  • Users implementing custom FieldGetter traits will need to update their implementations

qjerome added 3 commits March 6, 2026 16:16
- 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
@qjerome
qjerome merged commit bfa2f7e into main Mar 6, 2026
1 check passed
@qjerome
qjerome deleted the feat/field-name-iterator branch March 6, 2026 15:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant