Skip to content

structio 0.2.1

Choose a tag to compare

@stephenberry stephenberry released this 02 Sep 14:11
· 39 commits to main since this release

A read size that sizes the window, so a small document does not cost a 64 KiB buffer, and a hazard on read_seq written down.

[dependencies]
structio = "0.2"

Changed

  • Documents::read_size sizes the window as well as the read. The buffer is allocated on the first fill and holds one chunk, so Documents::array(bytes).read_size(4096) costs 4 KiB rather than the 64 KiB it allocated up front before, whatever the read size said. That matters where streaming is not the point: a document already in memory can still be worth reading through Documents, which is what hands out the elements of a typed array one at a time with their headers installed, and there the default window was a thousand times the document. Applies to both json::Documents and beve::Documents; Feed is unchanged, having no chunk size to go by.
  • beve::Reader::read_seq documents that element positions do not bound documents. A typed array's element headers, a complex array's, and a boolean run's are supplied by the reader rather than present in the input, so a span cut between two position() calls is not a value Reader::new can read. A caller slicing spans out of a walk has to check the array's header type first; Documents::array is the way to take elements as documents of their own, and accepts every array shape.

No API was added, removed or changed. Nothing needs editing to move from 0.2.0.