Skip to main content

Crate embeddenator_interop

Crate embeddenator_interop 

Source
Expand description

§embeddenator-interop

Interoperability layer for Embeddenator: format conversions, FFI, and language bindings.

Extracted from embeddenator core as part of Phase 2A component decomposition.

§Features

  • Format Conversions: Convert between JSON, bincode, and text formats
  • FFI Bindings: C-compatible interface for cross-language integration
  • Python Bindings: PyO3-based Python API (optional, enable python feature)
  • Adapters: High-level adapters for common integration patterns
  • Kernel Interop: Backend-agnostic VSA operations for runtime integration

§Modules

  • formats: Format conversion utilities
  • ffi: C FFI bindings (unsafe but documented)
  • [bindings]: Python bindings (requires python feature)
  • adapters: High-level adapter layers
  • kernel_interop: Kernel/runtime interop abstractions

§Examples

§Format Conversion

use embeddenator_interop::formats::{sparse_vec_to_format, OutputFormat};
use embeddenator_vsa::SparseVec;

let vec = SparseVec::new();
let json_bytes = sparse_vec_to_format(&vec, OutputFormat::Json).unwrap();
let text_bytes = sparse_vec_to_format(&vec, OutputFormat::Text).unwrap();

§File Operations

use embeddenator_interop::adapters::FileAdapter;
use embeddenator_vsa::SparseVec;
use embeddenator_io::CompressionCodec;

let vec = SparseVec::new();
FileAdapter::save_sparse_vec("vector.bin", &vec).unwrap();
let loaded = FileAdapter::load_sparse_vec("vector.bin").unwrap();

Re-exports§

pub use formats::FormatError;
pub use formats::OutputFormat;
pub use adapters::AutoFormatAdapter;
pub use adapters::BatchAdapter;
pub use adapters::EnvelopeAdapter;
pub use adapters::FileAdapter;
pub use adapters::StreamAdapter;
pub use kernel_interop::*;

Modules§

adapters
Adapter layers for external library integration.
ffi
FFI (Foreign Function Interface) bindings for C/C++ integration.
formats
Format conversion utilities for embeddenator types.
kernel_interop
Kernel ↔ VSA interop layer (non-FUSE).

Structs§

VSAHandle
Handle-based interface for C FFI compatibility

Functions§

export_to_json
import_from_json