This is a first step towards migrating WINGs/tree.c to Rust.
Happy finding: no parent pointer are actually needed, so we don't have to use a
shared structure for node pointers!
WMTreeWalk is only called once, with depthFirst set to true, so we might as well
just hard-code that behavior.
Also, this parameter appears to have been misnamed (since the search is always DFS)
and should properly be named to indicate that it controls if this is a pre- or
post-order traversal.
This is a bit of a red herring, since WMTree is only used in wmmenugen, which I
don't think I've ever directly used. See notes at the top of tree.rs for more
musings on whether this should be in wutil-rs at all.
trurl
changed title from Rewrite WUtils WMTreeNode in Rust to Rewrite WUtils tree.c in Rust2025-11-01 10:17:05 -04:00
trurl
requested review from cross 2025-11-01 10:39:01 -04:00
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
This reduces the surface area of the tree API because it's almost completely unused.
Rewrite WUtils WMTreeNode in Rustto Rewrite WUtils tree.c in Rust@@ -0,0 +96,4 @@}let parent = unsafe { &mut *parent };if tree.is_null() {I wonder about extracting this into a small function that wraps an
Optionor something? Probably not worth it.I think this is going to be replaced soon enough, so I'll merge as-is.
c598b034f5to9802b684ae