#[unsafe(no_mangle)]pub unsafe extern "C" fn hurray_writer_write_tensor(
handle: *mut HurrayWriter,
descriptor: *const HurrayDescriptor,
payloads: *const HurrayIoSlice,
count: usize,
) -> HurrayStatusExpand description
Writes one tensor — its descriptor then its payloads — blocking in the transport’s write callback as needed.
payloads MUST have one entry per buffer in the descriptor’s buffer table, in that
order, each with the declared byte_size. The whole tensor is validated before a byte
reaches the sink, so a mismatch is reported without putting a torn item on the wire.
Returns:
HURRAY_OK— the tensor is entirely written and the payload pointers are no longer held.HURRAY_ERR_SINK_CLOSED— the sink stopped accepting bytes mid-tensor, so a truncated item is on the wire. The writer is poisoned: every later call fails, and a fresh writer over the same connection is not a recovery.- Whatever status the write callback returned, if it failed before any byte of this
tensor reached the sink. Nothing was emitted, so the call MAY be retried. A failure
after the first byte is reported as
HURRAY_ERR_SINK_CLOSEDinstead, because at that point the damage is the same.
A composite is written with hurray_writer_write_composite; a composite head offered
here is refused, because a head alone is not a valid tensor.
§Safety
handleMUST point to a liveHurrayWriteranddescriptorto a liveHurrayDescriptor.- If
countis non-zero,payloadsMUST point tocountreadableHurrayIoSlicevalues, each describing memory readable for its ownlenbytes. - All of that memory MUST stay valid and unmodified until this call returns.