Skip to main content

decode_node

Function decode_node 

Source
pub fn decode_node(buf: &[u8; 4096]) -> Result<DecodedNode>
Expand description

Decode a B+tree page into a DecodedNode.

§Errors

Returns Error::Corruption if any field is malformed: bad page-type tag, key-count exceeding the slot cap, slot offset outside the page, varint length running past the page end, or keys not in ascending order.

§Perf note (Phase 7A audit)

The three Vecs on DecodedNode (children, leaves, internals) stay heap-allocated rather than heapless::Vec- backed. See the module-level Rule 3 note for the full allocator-vs-stack-frame analysis; in summary, the outer-vec cost is one allocation per leaf / two per internal — dwarfed by the 2N inner Vec<u8> allocations for the entry keys and values. The inner allocations are the real hot-path tax and require a borrowed-slice refactor of the node API to remove.