Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

process_read_dir doesn't give control over recursive state propagation #38

Open
g2p opened this issue Mar 9, 2023 · 0 comments · May be fixed by #39
Open

process_read_dir doesn't give control over recursive state propagation #38

g2p opened this issue Mar 9, 2023 · 0 comments · May be fixed by #39

Comments

@g2p
Copy link

g2p commented Mar 9, 2023

I would like to pass state from one ReadDir to the next.
I don't mind if it's ReadDirState or DirEntryState.

At the moment, I'm limited between passing the same state to all child directories (via ReadDirState), or I can pass state to all children (via DirEntry::client_state), but the entry or its state won't be accessible in the next process_read_dir call.

When using process_read_dir, I have access to the previous DirEntryState (cloned from the parent), and I can update it, but all ReadDir calls built from children will share the same ReadDirState, and I need to make them distinct.

I see two ways to fix this:

  • add an entry argument to the process_read_dir closure, replacing the current depth and path arguments with a DirEntry. Depth, path, client_state, file_type… can all be accessed on the entry.
  • split the children argument to the closure into yield_children and recurse_children (elements can appear on either or both). recurse_children should be a Vec<RecEntry> with RecEntry containing at least a path and a ReadDirState.
g2p added a commit to g2p/jwalk that referenced this issue Mar 10, 2023
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 a pull request may close this issue.

1 participant