pub fn merge_string_list<'a, V, B, F>(
views: &'a [V],
out: &mut B,
get_list: F,
) -> usizeExpand description
Merge a List(String) field using two-pass block copying.
§Layout of a string list in the source buffer
[jump_0][jump_1]...[jump_n-1] ← jump table: n × u32, each a forward offset
[len_0][bytes_0][len_1][bytes_1] ← string pool: length-prefixed UTF-8 blobsThe jump table and string pool are contiguous but at different addresses, and the jump values are position-relative — they must be recomputed when moved to the new buffer.
§Algorithm
Pass A — for each view, block-copy the string pool (everything from
offset + n*4 to last_offset + 4 + last_string_len) as a single
copy_from_slice. Records the destination base address (dest_pool_start)
for each view so Pass B can compute the fixup delta.
Pass B — for each view, block-copy the jump table, then add a constant delta to every entry. The delta collapses to:
delta = dest_pool_start - out.head()measured before subtracting the jump-table size. This works because both
the per-entry movement (dest_h - src_h_entry) and the per-string movement
(dest_pool - src_pool) are factored out identically across all entries
in the same view.
§Returns
The slot of the length-prefix u32, or 0 if all views were empty.