Skip to main content

hurray_reader_next_item

Function hurray_reader_next_item 

Source
#[unsafe(no_mangle)]
pub unsafe extern "C" fn hurray_reader_next_item( handle: *mut HurrayReader, out_item: *mut *mut HurrayItem, ) -> HurrayStatus
Expand description

Reads the next item: one tensor, or a composite and everything under it.

The assembled view of the same bytes hurray_reader_next_tensor reads flat. A composite head and its members arrive as one HurrayItem whose nodes a caller walks in preorder — see crate::item for the shape, and hurray_item_node for the walk.

Returns:

  • HURRAY_OK — *out_item is a new HurrayItem, to be released with hurray_item_destroy.
  • HURRAY_END_OF_STREAM — input ended cleanly at an item boundary. *out_item is untouched.
  • HURRAY_ERR_INVALID_STREAM — the stream ended with a composite head still owed members, or a group failed validation (member count, partition coverage, overlay ordering).
  • HURRAY_ERR_LIMIT_EXCEEDED — nesting exceeded max_composite_depth.
  • Whatever status the read callback returned, if it failed. The reader’s position is intact, so the same call MAY be retried and resumes mid-tensor.

Both views come from one core, and the assembly happens on this side of it. So mixing the two calls on one reader is allowed but rarely meant: a hurray_reader_next_tensor issued while a composite head is open takes the member that head was waiting for, and the group stays open for the rest of the stream.

§Safety

  • handle MUST point to a live HurrayReader.
  • out_item MUST be a valid, non-null, writable pointer.