serde-json-core icon indicating copy to clipboard operation
serde-json-core copied to clipboard

Support for "block-wise" serialization?

Open JKRhb opened this issue 3 years ago • 0 comments
trafficstars

Firstly, thanks for providing this crate :)

Using the crate in the context of CoAP (the Constrained Application Protocol, RFC 7252), it would be nice if you could serialize structs in a "block-wise" manner, i.e., in chunks of a certain byte-size, where the position of the chunk "window" could be chosen arbitrarily.

This would not only allow for an easier implementation of CoAP block-wise transfer (see RFC 7959), but also save some memory on constrained devices as you would only need to have a buffer of that specific size for the result, presumably at a higher computational cost for the serialization overall, as you would need several runs for the moving window, supposing that you cannot begin where you left off after the previous one.

Do you think it would be possible to add a feature like this or accept a PR? Or would you consider it out of scope of this crate?

JKRhb avatar Sep 15 '22 17:09 JKRhb