Skip to main content

Crate hurray_ffi

Crate hurray_ffi 

Source
Expand description

§hurray-ffi

C ABI layer for hurray language bindings.

This crate exposes opaque handles, a function table, and buffer release callbacks via a stable C ABI. It is the foundation for all non-Rust language bindings.

§Safety contract

  • No panics may propagate across the FFI boundary. All extern "C" functions wrap their bodies in std::panic::catch_unwind.
  • All unsafe blocks carry a // SAFETY: comment explaining soundness.
  • Buffer pointers MUST be aligned to at least 64 bytes.

§C ABI version

The C ABI version is exposed via HURRAY_C_ABI_VERSION and the function hurray_c_abi_version. Callers SHOULD check this at startup to detect incompatible library versions.

Re-exports§

pub use buffer::hurray_buffer_from_ptr;
pub use buffer::HurrayBuffer;
pub use buffer::HurrayReleaseCallback;
pub use buffer_list::hurray_buffer_list_new;
pub use buffer_list::HurrayBufferList;
pub use composite::HurrayCompositeNode;
pub use descriptor::hurray_descriptor_decode;
pub use descriptor::HurrayDescriptor;
pub use field::hurray_descriptor_field_f64;
pub use field::hurray_descriptor_field_i64;
pub use field::hurray_descriptor_field_i64_array;
pub use field::hurray_descriptor_field_u64;
pub use field::hurray_descriptor_field_u64_array;
pub use field::HurrayDescriptorField;
pub use file::hurray_file_reader_destroy;
pub use file::hurray_file_reader_kv_count;
pub use file::hurray_file_reader_kv_entry;
pub use file::hurray_file_reader_new;
pub use file::hurray_file_reader_read_composite;
pub use file::hurray_file_reader_read_descriptor;
pub use file::hurray_file_reader_read_tensor;
pub use file::hurray_file_reader_tensor_count;
pub use file::hurray_file_reader_tensor_name;
pub use file::hurray_file_writer_destroy;
pub use file::hurray_file_writer_finish;
pub use file::hurray_file_writer_new;
pub use file::hurray_file_writer_write_composite;
pub use file::hurray_file_writer_write_tensor;
pub use file::HurrayFileReader;
pub use file::HurrayFileWriter;
pub use file::HurrayFileWriterOptions;
pub use file::HurrayKvEntry;
pub use file::HurrayKvValue;
pub use file::HURRAY_KV_ARRAY;
pub use file::HURRAY_KV_BOOL;
pub use file::HURRAY_KV_BYTES;
pub use file::HURRAY_KV_FLOAT64;
pub use file::HURRAY_KV_INT64;
pub use file::HURRAY_KV_STRING;
pub use file::HURRAY_KV_UINT64;
pub use item::hurray_item_destroy;
pub use item::hurray_item_kind;
pub use item::hurray_item_node;
pub use item::hurray_item_node_count;
pub use item::HurrayItem;
pub use item::HurrayItemNode;
pub use item::HURRAY_ITEM_COMPOSITE;
pub use item::HURRAY_ITEM_TENSOR;
pub use status::HurrayStatus;
pub use status::HURRAY_END_OF_STREAM;
pub use status::HURRAY_ERR_BUFFER_TOO_SMALL;
pub use status::HURRAY_ERR_CORE_UNUSABLE;
pub use status::HURRAY_ERR_FIELD_NOT_APPLICABLE;
pub use status::HURRAY_ERR_FIELD_NOT_PRESENT;
pub use status::HURRAY_ERR_INDEX_OUT_OF_BOUNDS;
pub use status::HURRAY_ERR_INTERNAL;
pub use status::HURRAY_ERR_INTERNAL_PANIC;
pub use status::HURRAY_ERR_INVALID_FILE;
pub use status::HURRAY_ERR_INVALID_LAYOUT;
pub use status::HURRAY_ERR_INVALID_MAGIC;
pub use status::HURRAY_ERR_INVALID_STREAM;
pub use status::HURRAY_ERR_INVALID_SYNC_MODE;
pub use status::HURRAY_ERR_INVALID_TYPE;
pub use status::HURRAY_ERR_LIMIT_EXCEEDED;
pub use status::HURRAY_ERR_NOT_COMPOSITE;
pub use status::HURRAY_ERR_NOT_FOUND;
pub use status::HURRAY_ERR_NULL_POINTER;
pub use status::HURRAY_ERR_SINK_CLOSED;
pub use status::HURRAY_ERR_SYNC_MODE_MISMATCH;
pub use status::HURRAY_ERR_TRANSPORT;
pub use status::HURRAY_ERR_UNEXPECTED_EOF;
pub use status::HURRAY_ERR_VERSION_MISMATCH;
pub use status::HURRAY_OK;
pub use stream::hurray_reader_destroy;
pub use stream::hurray_reader_new;
pub use stream::hurray_reader_next_item;
pub use stream::hurray_reader_next_tensor;
pub use stream::hurray_writer_destroy;
pub use stream::hurray_writer_new;
pub use stream::hurray_writer_write_composite;
pub use stream::hurray_writer_write_tensor;
pub use stream::HurrayIoSlice;
pub use stream::HurrayReader;
pub use stream::HurrayReaderOptions;
pub use stream::HurrayTransport;
pub use stream::HurrayTransportReadAtFn;
pub use stream::HurrayTransportReadFn;
pub use stream::HurrayTransportReleaseFn;
pub use stream::HurrayTransportSizeFn;
pub use stream::HurrayTransportWriteFn;
pub use stream::HurrayWriter;
pub use stream::HurrayWriterOptions;
pub use sync::HurrayEventReleaseFn;
pub use sync::HurraySyncConsumerStreamPayload;
pub use sync::HurraySyncEventPayload;
pub use tensor::hurray_tensor_abi_version;
pub use tensor::hurray_tensor_buffers;
pub use tensor::hurray_tensor_descriptor;
pub use tensor::hurray_tensor_destroy;
pub use tensor::hurray_tensor_new;
pub use tensor::HurrayOwnerReleaseFn;
pub use tensor::HurrayTensor;

Modules§

buffer
Opaque buffer handle for the Hurray C ABI.
buffer_list
Opaque list of buffer handles for multi-buffer tensors (ADR-030).
composite
Writing a composite from C: the node array, and the borrowed tree it becomes.
descriptor
Opaque tensor descriptor handle for the Hurray C ABI.
field
Descriptor field reads for the Hurray C ABI (ADR-039, ADR-040).
file
Blocking HRRYFILE reads and writes over a caller-supplied transport (ADR-041 § 8).
item
A read item: one tensor, or a composite and everything under it.
status
Status codes and error mapping for the Hurray C ABI.
stream
Blocking stream read and write over a caller-supplied transport (ADR-041 § 8).
sync
Synchronization mode handoff cross-checks for the Hurray C ABI.
tensor
A tensor handle: a descriptor and its buffers, paired structurally.

Constants§

HURRAY_C_ABI_VERSION
The integer version of the Hurray C ABI exposed by this build.

Functions§

hurray_c_abi_version
Returns the HURRAY_C_ABI_VERSION constant.