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

feat(add compact arrays): we can now have nice one line syntax for arrays #299

Closed
wants to merge 6 commits into from

Conversation

hube12
Copy link

@hube12 hube12 commented Mar 12, 2021

This refer to my recent issue #298 where I mention I would love a compact array definition,
This PR allow to do so by using the with_compact_arrays(true), the default is false ofc.

assert_eq!(
        to_string_pretty(&&[(), (), ()][..], PrettyConfig::new().with_new_line("\n".to_string()).with_compact_arrays(true)).unwrap(),
        "[(),(),()]"
    );

src/ser/mod.rs Outdated Show resolved Hide resolved
@hube12
Copy link
Author

hube12 commented Mar 15, 2021

I think it has good as it can gets for this specific use case, there is still the issue of structs inside array so maybe compact_arrays could be extended to compact_array_if_level_below(level) so only leaf structure are compact but nested ones aren't

@torkleyy
Copy link
Contributor

I think it has good as it can gets for this specific use case, there is still the issue of structs inside array so maybe compact_arrays could be extended to compact_array_if_level_below(level) so only leaf structure are compact but nested ones aren't

Either that, or define a char limit for "compact arrays" (could do the same with structs / maps, too, I guess)

@kvark
Copy link
Collaborator

kvark commented Mar 15, 2021

Here are 2 things that we'll need to follow-up with:

  1. same PR as this for the master branch
  2. add a commit to this PR with a patch version bump and a short CHANGELOG entry

@github-actions
Copy link

Issue has had no activity in the last 60 days and is going to be closed in 7 days if no further activity occurs

@github-actions github-actions bot added the stale label Nov 18, 2021
@github-actions github-actions bot closed this Nov 25, 2021
@kvark kvark reopened this Dec 3, 2021
@github-actions github-actions bot closed this Dec 11, 2021
@kvark
Copy link
Collaborator

kvark commented Dec 17, 2021

comment

@kvark kvark reopened this Dec 17, 2021
juntyr added a commit to juntyr/ron that referenced this pull request Dec 18, 2021
torkleyy added a commit that referenced this pull request Dec 18, 2021
Add compact arrays (#299) and pretty inline separators
@juntyr
Copy link
Member

juntyr commented Dec 18, 2021

The compact_arrays option has now been included in #349

@juntyr juntyr closed this Dec 18, 2021
torkleyy added a commit to torkleyy/ron that referenced this pull request Jun 6, 2022
Add compact arrays (ron-rs#299) and pretty inline separators
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants