Document how to customize JSON decoding via DecoderFactory - #10897
Conversation
aaeff15 to
5e28394
Compare
| //! | ||
| //! The lower-level [`Decoder`] can be integrated with various forms of async data streams, | ||
| //! and is designed to be agnostic to the various different kinds of async IO primitives found | ||
| //! The lower-level [`Decoder`] can be integrated with various forms of async |
There was a problem hiding this comment.
drive by to make the text clearer
| //! } | ||
| //! ``` | ||
| //! | ||
| //! # Customizing the decoder |
There was a problem hiding this comment.
This is the main purpose of this PR: leave a note here about how to customize the decoder
| /// implementation with [`ReaderBuilder::with_decoder_factory`]. | ||
| /// | ||
| /// # Examples | ||
| /// # Example: Decode `Binary` from a JSON array of integers |
There was a problem hiding this comment.
The example originally showed how to use the decoder factory as well as switch on the extension type. I think it would be clearer to have separate examples, so I split it into two examples and added some comments
| /// [`WriterBuilder::with_encoder_factory`]: crate::writer::WriterBuilder::with_encoder_factory | ||
| /// | ||
| /// # Examples | ||
| /// # Example: Encode a `BinaryArray` as an array of integers |
There was a problem hiding this comment.
I tried to make the examples here a little clearer and added some more explanatory docs
| //! writing / after reading, as shown in the following example. | ||
| //! | ||
| //! [Customizing the encoder]: writer#customizing-the-encoder | ||
| //! [Customizing the decoder]: reader#customizing-the-decoder |
There was a problem hiding this comment.
here is the main entry to help people find the new feature
Adds crate-level and reader-module doc pointers to the `DecoderFactory` extension point added in apache#10670, mirroring the encoder documentation added in apache#10741.
5e28394 to
ff1278a
Compare
Rich-T-kid
left a comment
There was a problem hiding this comment.
I'm not super familiar with the json crate, but the documentation seems clear & concise
Which issue does this PR close?
N/A -- documentation only.
Rationale for this change
DecoderFactory, but the docs don't mention it, so users would only find the hook by stumbling onReaderBuilder::with_decoder_factory.What changes are included in this PR?
This adds the matching pointers for decoding that #10741 added for encoding, as anticipated in that PR's description.
I also cleaned up some other docs while I was reviewing the original PR
Are these changes tested?
Covered by existing doc tests and CI rustdoc link checking.
Are there any user-facing changes?
Documentation only.