I decided to learn how to use the popular Rust library serde.rs by making a full deserializer and serializer library for the KRDS format (this is sort of a practice run before I attempt a full KPF and KFX serializer/deserializer.) You just have to define the format you are trying to read as a Rust structure. I have already done this for yjr, yjf, azw3r and azw3f files. It should be very easy to add support for any other KRDS files that come up as all that needs to be done is define field names.
The code for this is published in a GitHub repo.
https://github.com/willemml/krds_serde
There is a discrepancy in yjr and azw3r files in that the Kindle (in my case the Scribe) serializes empty strings as "0x03 0x00 0x00 x00" whereas yjf (and azw3f) files serialize them as "0x03 0x01" I have chosen to use this shorter format for all files (and the Kindle does not complain, I have tested editing annotations and it works.) Other than that binary output of the serializer is identical to an input binary. The code is currently rough and undocumented, but it works and has tests.