Highlights
serialized_size — exact streaming length without producing bytes (#22)
serialized_size / serialized_size_with_options compute the exact number of bytes to_writer_streaming will emit for a value, without producing them. They drive the same encoder as the streaming serializer through a counting sink, so the measurement is correct by construction and cannot drift from what is actually written.
This enables single-pass, zero-intermediate-buffer length-prefixed framing over a non-seekable transport (e.g. a socket): measure the body, write the length prefix, then stream the body once. The measure is O(1) for serialize_bytes and TypedSlice<T> bodies and O(N) for a bare numeric Vec<T>; unknown-length containers are rejected exactly as to_writer_streaming rejects them.
Bulk-slice fast path for typed numeric slices (#21)
TypedSlice<T>, to_writer_typed_slice, and the closed-form typed_slice_size give O(1) encoding and measuring of a contiguous numeric slice: a typed-array header, a SIZE prefix, and a single bulk write_all of the payload on little-endian targets (with a per-element fallback on big-endian).
Other changes
- The
fieldmodule is now public (pub mod field), surfacing its JSON Pointer (RFC 6901) reference documentation and examples. Additive —from_field/from_field_slice/skip_valueremain re-exported at the crate root. - Added
benches/serialized_size.rs(Criterion) validating the O(1)/O(N) cost model. - Documentation and rustdoc cleanup;
cargo doc -D warningsis clean.
All changes are additive — no removals or signature changes — so this is a minor release.