feat(rpc-types-trace): add depth-first iterator for CallFrame#3768
Merged
mattsse merged 4 commits intoalloy-rs:mainfrom Apr 8, 2026
Merged
feat(rpc-types-trace): add depth-first iterator for CallFrame#3768mattsse merged 4 commits intoalloy-rs:mainfrom
mattsse merged 4 commits intoalloy-rs:mainfrom
Conversation
Add `CallFrame::iter()` which returns a `CallFrameIter` that traverses the call tree in depth-first pre-order. The iterator supports `skip_children()` to avoid descending into the children of the most recently yielded frame, enabling selective subtree skipping. Closes alloy-rs#2775
mattsse
approved these changes
Apr 8, 2026
Member
mattsse
left a comment
There was a problem hiding this comment.
Reviewed locally; the iterator API, traversal behavior, docs, and tests look good.
This was referenced Apr 8, 2026
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.
Motivation
CallFrameis a recursive structure where each frame can contain nested child calls. Traversing this tree currently requires manual recursion. This PR adds an ergonomic iterator with subtree-skipping support.Solution
Added
CallFrame::iter()which returns aCallFrameIterthat traverses the call tree in depth-first pre-order using an internal stack.API
skip_children()Removes the children of the most recently yielded frame from the internal stack, so iteration continues with the next sibling or ancestor. This is useful for filtering out subtrees (e.g. skipping delegate calls, or only inspecting top-level calls in a trace).
Closes #2775