Skip to content

Customizable buffer type (proof of concept) - #2912

Draft
dtolnay wants to merge 1 commit into
serde-rs:masterfrom
dtolnay:buffer
Draft

Customizable buffer type (proof of concept)#2912
dtolnay wants to merge 1 commit into
serde-rs:masterfrom
dtolnay:buffer

Conversation

@dtolnay

@dtolnay dtolnay commented Mar 22, 2025

Copy link
Copy Markdown
Member

This demonstrates a backward compatible way that a format such as serde_json could use its own serde_json::Value as its buffer type for untagged enums and flatten, instead of "Content", solving #1183. Uses "return position impl trait in traits" (stabilized in Rust 1.75 by rust-lang/rust#115822) and "precise capturing in traits" (stabilized in Rust 1.87 by rust-lang/rust#138128).

@juntyr

juntyr commented Mar 23, 2025

Copy link
Copy Markdown

This would be WONDERFUL, thank you @dtolnay for exploring it <3

@Mingun

Mingun commented Mar 23, 2025

Copy link
Copy Markdown
Contributor

I hope, that before landing this, you will look at least an one implementation for a format other than JSON-like. I can help with testing this approach in quick-xml.

@juntyr

juntyr commented Mar 23, 2025

Copy link
Copy Markdown

I'm a maintainer for RON and we'd also be very interested

@juntyr

juntyr commented Jul 24, 2025

Copy link
Copy Markdown

@dtolnay We just had another bug report in RON that we cannot fix because of not being able to customize the content/buffer type. Since precise capturing in traits was released in 1.87, would you be able to take another look at this PR?

@radu-byte

This comment was marked as spam.

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.

4 participants