Skip to main content

Module bulk_bytes

Module bulk_bytes 

Source
Expand description

Bulk-payload serde helpers. Public so an out-of-tree extension can give its own opaque payloads the same treatment dora gives its own, rather than duplicating the visitor — see docs/extensions.md. Bulk-payload serde for AVec<u8, ConstAlign<128>>.

serde’s default impl for a byte container is a sequence of u8, so the encoder writes the payload one element at a time. Routing it through serialize_bytes/deserialize_bytes instead lets the codec move the whole slice at once, which is 50–65x faster on payload-sized buffers.

The encoding is unchanged. postcard writes a varint length followed by the raw bytes either way, so this is a pure speedup — no wire-format version bump. encoding_is_unchanged_from_the_seq_form pins that, including at the varint length-prefix boundaries. In self-describing formats the two forms also agree: serde_json renders both as an array of numbers, and the visitor below accepts that shape back via [Visitor::visit_seq].

Deserialization preserves the 128-byte alignment the Arrow zero-copy decode path depends on — see daemon_path_ipc_roundtrip_preserves_payload_and_alignment.

Modules§

option
The same treatment for an Option<AVec<..>> field.
vec
The same bulk-bytes treatment for a plain Vec<u8> field.

Functions§

deserialize
serialize