#[unsafe(no_mangle)]pub unsafe extern "C" fn hurray_writer_write_composite(
handle: *mut HurrayWriter,
nodes: *const HurrayCompositeNode,
count: usize,
) -> HurrayStatusExpand description
Writes a composite — its head, then every member, nested ones included — as one item.
nodes is the composite in preorder: nodes[0] is the head, and each node declares
how many of the nodes after it are its direct members. crate::composite has the
shape and an example layout; names are ignored here, because the stream wire carries
none.
The whole tree is validated before a byte reaches the sink — member counts at every level, partition exact-cover, overlay base-first ordering — so an invalid composite is refused rather than half written. Payload slices stay borrowed throughout: nothing is copied or concatenated (ADR-041 § 3).
Returns:
HURRAY_OK— the composite is entirely written and the payload pointers are no longer held.HURRAY_ERR_NOT_COMPOSITE—countis0, ornodes[0]is not a composite head. Usehurray_writer_write_tensorfor a tensor.HURRAY_ERR_INDEX_OUT_OF_BOUNDS— the member counts do not describe the array: a head declares members the array does not carry, or nodes trail after the head’s subtree is complete.HURRAY_ERR_INVALID_LAYOUT— the tree is not a valid composite: a head that is not one, a member count that disagrees with the head, a partition that does not cover its index space, an overlay whose base is not first. Refused before a byte moved, so the writer stays usable.HURRAY_ERR_SINK_CLOSED— the sink stopped accepting bytes mid-composite, so a truncated item is on the wire and the writer is poisoned. A composite is one item: there is no partially valid composite to resume from.- Whatever status the write callback returned, if it failed before any byte of this composite reached the sink. Nothing was emitted, so the call MAY be retried.
§Safety
handleMUST point to a liveHurrayWriter.- If
countis non-zero,nodesMUST point tocountreadableHurrayCompositeNodevalues, each satisfying that type’s own pointer contract. - All of that memory MUST stay valid and unmodified until this call returns.