Expand description
Opaque carrier for everything a native-protocol capsule holds beyond its buffers (ADR-034).
A capsule carries two things: its pointer is a
HurrayBufferList, and its context is a
HurrayTensorContext. The list holds the bytes; the context holds the
encoded tensor descriptor that says what those bytes are — element type,
shape, layout, quantization — plus the ABI version of the build that produced
them.
Before ADR-034 the context was a Rust struct private to hurray-python, so
only hurray-python could read it. The buffers crossed the language boundary
and the descriptor did not, which made the protocol’s full-fidelity promise
true between two Python peers and false for every other binding.
§Reading one
Check the version first, always — see hurray_tensor_context_abi_version.
Every other accessor assumes a caller that has done so.
§The owner
A context keeps its producer’s tensor alive: the buffers point into memory
something else owns. That something is passed in as an opaque owner pointer
with an owner_release callback, and this crate never interprets either —
which is what lets hurray-python park a Python reference there without any
Python type reaching the C ABI.
Structs§
- Hurray
Tensor Context - Opaque handle to a capsule’s tensor context: descriptor bytes, ABI version, and an owner reference.
Functions§
- hurray_
tensor_ ⚠context_ abi_ version - Reads the ABI version recorded by the producing build.
- hurray_
tensor_ ⚠context_ descriptor - Borrows the encoded tensor descriptor.
- hurray_
tensor_ ⚠context_ destroy - Destroys a
HurrayTensorContext, invoking its owner-release callback, and nulls the caller’s pointer. - hurray_
tensor_ ⚠context_ new - Creates a
HurrayTensorContextowning a copy ofdescriptor_bytes.
Type Aliases§
- Hurray
Owner Release Fn - Callback invoked exactly once by
hurray_tensor_context_destroyto release whatever keeps the tensor’s memory alive.