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

Implement pretty printing of (sub)tree for debugging purpose #87

Merged

Conversation

lo48576
Copy link
Contributor

@lo48576 lo48576 commented Aug 31, 2022

Resolves #86.

Adds a method NodeId::debug_pretty_print(arena :&mut Arena<T>) -> DebugPrettyPrint<'_, T> that enables a (sub)tree to be pretty-printed.
See tests/debug_pretty_print.rs for (current) expected outputs.

A note about licensing

Most of the codes are derived from my crates treena and dendron (yeah, this man is writing tree manipulation crates again and again for some reason! 🤣).
Those pretty-printing implementations are also written by me and distributed by MIT/Apache-2.0, and this pull request is written and submitted by me (the same person), so I believe there are no licensing issues.
(Just in case: I hereby declare that I permit indextree (and other derived works) to treat these codes under MIT license.)

@codecov
Copy link

codecov bot commented Aug 31, 2022

Codecov Report

Merging #87 (75aaf91) into main (f328d55) will decrease coverage by 0.1%.
The diff coverage is 61.7%.

@@           Coverage Diff           @@
##            main     #87     +/-   ##
=======================================
- Coverage   62.7%   62.5%   -0.2%     
=======================================
  Files          7       8      +1     
  Lines        381     470     +89     
  Branches     121     149     +28     
=======================================
+ Hits         239     294     +55     
- Misses        36      52     +16     
- Partials     106     124     +18     

@lo48576
Copy link
Contributor Author

lo48576 commented Aug 31, 2022

Appvayor failures seems to be caused by too old compiler.
Is there any MSRV policy for this project?

@saschagrunert
Copy link
Owner

Appvayor failures seems to be caused by too old compiler. Is there any MSRV policy for this project?

So the only policy is that it should build for windows 😁

* `{}`: `Display` default
* `{:#}`: `Display` alternate
* `{:?}`: `Debug` default
* `{:#?}`: `Debug` alternate
Copy link
Owner

@saschagrunert saschagrunert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome, thank you!

@saschagrunert saschagrunert merged commit 7dd4eab into saschagrunert:main Sep 2, 2022
@lo48576 lo48576 deleted the feature/debug-pretty-print branch September 2, 2022 13:24
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.

pretty print indextree
2 participants