Document how to customize JSON encoding via EncoderFactory - #10741
Merged
Conversation
alamb
marked this pull request as ready for review
August 18, 2026 18:29
alamb
commented
Aug 18, 2026
| /// This trait allows customizing JSON encoding for specific data types, | ||
| /// or adding new encoders for unsupported or custom data types. | ||
| /// | ||
| /// You can register an implementation of this trait using |
Contributor
Author
There was a problem hiding this comment.
I am trying to point people / agents to the right APIs
| //! ); | ||
| //! ``` | ||
| //! | ||
| //! ## Customizing the encoder |
Contributor
Author
There was a problem hiding this comment.
this is the core change -- add a note at the top level that says you can customize the encoder
| //! | ||
| //! [Customizing the encoder]: writer#customizing-the-encoder | ||
| //! | ||
| //! ## `Base64` Encoding Example |
Contributor
Author
There was a problem hiding this comment.
I think we should consider removing the entire Base64 example here as it would be better to simply use the encoding factory I think, rather than copying the input initially
Jefffrey
approved these changes
Aug 19, 2026
Contributor
Author
|
Thank you @Jefffrey |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Which issue does this PR close?
N/A -- documentation only.
Rationale for this change
The ability to customize JSON encoding via
EncoderFactorywas added in #7015, but neither the crate-level docs nor the writer module docs mention it, so users only find the hook by stumbling onWriterBuilder::with_encoder_factory.What changes are included in this PR?
Documentation only, no code changes:
EncoderFactoryas an alternative for binary data encodingIt would be nice to add a matching pointer for customizing decoding as part of #10670
Are these changes tested?
Covered by existing doc tests and CI rustdoc link checking.
Are there any user-facing changes?
Documentation only.