Expand description
FFI (Foreign Function Interface) bindings for C/C++ integration.
This module provides C-compatible bindings for embeddenator core types.
All functions are marked unsafe and require careful memory management.
§Safety Considerations
- All pointers must be valid and properly aligned
- String pointers must be null-terminated UTF-8
- Caller is responsible for freeing memory allocated by FFI functions
- No Rust objects should be accessed after being freed
§Example (C)
#include "embeddenator_interop.h"
// Create a vector
SparseVecHandle* vec = sparse_vec_new();
// Use the vector...
// Free the vector
sparse_vec_free(vec);Structs§
- Byte
Buffer - Result buffer for returning data to C
- Sparse
VecHandle - Opaque handle to a SparseVec
- VSAConfig
Handle - Opaque handle to a ReversibleVSAConfig
Functions§
- byte_
buffer_ ⚠free - Free a ByteBuffer returned by FFI functions
- embeddenator_
last_ ⚠error - Get the last error message (if any)
- sparse_
vec_ ⚠bind - Bind two SparseVecs
- sparse_
vec_ ⚠bundle - Bundle two SparseVecs
- sparse_
vec_ ⚠cosine - Compute cosine similarity between two SparseVecs
- sparse_
vec_ ⚠free - Free a SparseVec
- sparse_
vec_ ⚠from_ json - Deserialize a SparseVec from JSON
- sparse_
vec_ ⚠new - Create a new SparseVec
- sparse_
vec_ ⚠to_ json - Serialize a SparseVec to JSON
- vsa_
config_ ⚠free - Free a VSAConfig
- vsa_
config_ ⚠new - Create a new default ReversibleVSAConfig
- vsa_
config_ ⚠new_ custom - Create a new ReversibleVSAConfig with custom parameters
- vsa_
decode_ ⚠data - Decode a SparseVec back to data
- vsa_
encode_ ⚠data - Encode data into a SparseVec