-
Notifications
You must be signed in to change notification settings - Fork 123
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
Limit the pretty depth #93
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice :) Please add some tests to it. As for the unresolved questions, I would answer both of them with "Yes".
Agreed. Thank you for coding this. |
Addressing 1/2 in a separate WIP PR #94 |
For the test I think asserting the above output would be enough. |
@torkleyy a test has been added. Notice that the hashmap only has one element (contrary to the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
self.output += if self.separate_tuple_members() { | ||
&config.new_line | ||
} else { | ||
" " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume this gets fixed in the follow-up? Otherwise we don't have whitespaces between tuple fields.
bors r+ |
93: Limit the pretty depth r=torkleyy a=kvark Fixes #92 cc @pyfisch Output of `cargo run --example encode`: ```yaml ( float: (2.18,-1.1,), tuple: ((),false,), map: {0:'1',8:'1',3:'5',1:'2',}, nested: (a:"Hello from \"RON\"",b:'b',), var: A(255,"",), array: [(),(),(),], ) ``` Unresolved questions: 1. should we omit the trailing comma for non-pretty output? Given that it's on the same line, it sort of makes sense. It would just affect more than just the `depth_limit` parameter. 2. do we still want to put spaces after commas for pretty output behind the depth limit?
Build succeeded |
Fixes #92
cc @pyfisch
Output of
cargo run --example encode
:Unresolved questions:
depth_limit
parameter.