Skip to content

Implement Default for CompactFormatter#1268

Merged
dtolnay merged 1 commit into
serde-rs:masterfrom
SOF3:compact-default
Aug 19, 2025
Merged

Implement Default for CompactFormatter#1268
dtolnay merged 1 commit into
serde-rs:masterfrom
SOF3:compact-default

Conversation

@SOF3

@SOF3 SOF3 commented Jul 6, 2025

Copy link
Copy Markdown
Contributor

This allows libraries to provide an API like

impl<W, F> SomeWrapper<W, F> {
    pub fn new_serializer(writer: W) -> impl serde::Serializer
    where
        F: Default,
    {
        serde_json::Serializer::with_formatter(writer, F::default())
    }
}

@dtolnay dtolnay left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks!

@dtolnay
dtolnay merged commit 8be6647 into serde-rs:master Aug 19, 2025
16 checks passed
@SOF3
SOF3 deleted the compact-default branch August 19, 2025 06:16
takumi-earth pushed a commit to earthlings-dev/json that referenced this pull request Jan 27, 2026
Implement Default for CompactFormatter
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants