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

Recursive helper? #411

Open
matthiasbeyer opened this issue Jan 21, 2021 · 1 comment
Open

Recursive helper? #411

matthiasbeyer opened this issue Jan 21, 2021 · 1 comment

Comments

@matthiasbeyer
Copy link
Contributor

Hi,

would it be possible to build a recursive helper for recursing on a tree-like structure?

E.G.:

{{recurse_with element.children tree}}
print something for {{element.value}}
{{/recurse_with}}

For a tree structure where

struct Tree {
  value: String,
  children: Vec<Tree>
}

For example? The first argument of the recurse_with helper would be a selector that gets the list of children nodes from a node.


To expand on that, I would like to implement depth-first and breadth-first recursion, but that shouldn't be too complicated if the basic helper is implemented.

@matthiasbeyer
Copy link
Contributor Author

Argh,... my problem is actually not a tree structure, but a BTreeMap<Key, Value> where each value holds a list of Keys that are also in the map.
So, I actually do not need a recursive tree helper, but something different.

I'll leave this open anyways, it might be interesting for others.

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

No branches or pull requests

1 participant