Expand description
Blocking stream read and write over a caller-supplied transport (ADR-041 § 8).
hurray-io is async and generic over Tokio’s traits; the C ABI is blocking and returns
status codes. What connects them is not a bridge but a shared foundation: hurray-io’s
sans-io core is a state machine over bytes, and these handles are a second driver for
it — the first being the Tokio one. No runtime is linked into a C consumer’s binary.
The division of labour:
- the core decides what bytes it needs next and never blocks,
- the transport (
HurrayTransport) moves those bytes and MAY block, - these handles carry counts between the two.
That is what lets the blocking contract live entirely in the caller’s callbacks.
Scope: tensors and composites. The reader offers both views of the same bytes —
hurray_reader_next_tensor in wire order, where a composite head is the buffer-less
tensor it is on the wire, and hurray_reader_next_item assembled, where a composite
arrives whole. One core, two views, which is what step 2 of ADR-041 set up. File
containers are
crate::file’s: they are addressed rather than consumed, so they drive the
random-access core over the vtable’s read_at and size callbacks.
Structs§
- Hurray
IoSlice - One borrowed payload: a pointer and a length.
- Hurray
Reader - Opaque handle to a blocking stream reader.
- Hurray
Reader Options - Resource limits and transport assumptions for a reader.
- Hurray
Transport - A caller-supplied byte transport: a context pointer plus the callbacks that move bytes.
- Hurray
Writer - Opaque handle to a blocking stream writer.
- Hurray
Writer Options - Transport assumptions for a writer.
Functions§
- hurray_
reader_ ⚠destroy - Destroys a reader, releases its transport context, and writes null through
handle. - hurray_
reader_ ⚠new - Creates a reader over
transport. - hurray_
reader_ ⚠next_ item - Reads the next item: one tensor, or a composite and everything under it.
- hurray_
reader_ ⚠next_ tensor - Reads the next tensor, blocking in the transport’s read callback as needed.
- hurray_
writer_ ⚠destroy - Destroys a writer, releases its transport context, and writes null through
handle. - hurray_
writer_ ⚠new - Creates a writer over
transport. - hurray_
writer_ ⚠write_ composite - Writes a composite — its head, then every member, nested ones included — as one item.
- hurray_
writer_ ⚠write_ tensor - Writes one tensor — its descriptor then its payloads — blocking in the transport’s write callback as needed.
Type Aliases§
- Hurray
Transport Read AtFn - Reads up to
lenbytes from absolute offsetoffsetintodst, reporting the count throughout_filled. - Hurray
Transport Read Fn - Reads up to
lenbytes intodst, reporting the count throughout_filled. - Hurray
Transport Release Fn - Releases the transport’s context pointer when the handle that owns it is destroyed.
- Hurray
Transport Size Fn - Reports the total size of the input in bytes.
- Hurray
Transport Write Fn - Writes up to
lenbytes fromsrc, reporting the count throughout_written.