Rust FFI source: src/
C header (stable ABI): include/lance.h
C++ RAII wrappers (header-only): include/lance.hpp
Tests (Rust): tests/c_api_test.rs
Tests (C/C++): tests/cpp/
Historical test data: test_data/
check: cargo check --all-targets
format: cargo fmt
lint: cargo clippy --all-targets -- -D warnings
test: cargo test
test C/C++ compilation: cargo test --test compile_and_run_test -- --ignored
- Opaque handles with
lance_*_open/lance_*_closelifecycle. - Thread-local error handling via
ffi_try!macro. - Arrow C Data Interface for zero-copy data exchange.
panic = "abort"in release to prevent unwinding across FFI.
- Keep C/C++ bindings as thin wrappers — centralize validation and logic in the Rust core.
- Keep parameter names consistent across all bindings (Rust, C, C++) — rename everywhere or nowhere.
- Never break public API signatures — deprecate with
#[deprecated]and add a new method. - Replace mutually exclusive boolean flags with a single enum/mode parameter.
- Name variables after what the value is (e.g.,
partition_idnotmask). - Drop redundant prefixes when the struct/module already implies the domain.
- Use
indices(notindexes) consistently in all APIs and docs.
- Validate inputs and reject invalid values with descriptive errors at API boundaries — never silently clamp or adjust.
- Include full context in error messages: variable names, values, sizes, types.
- All bugfixes and features must have corresponding tests.
- Cover NULL/empty edge cases.
- Include multi-fragment scenarios for dataset operations.
- Prefer the standard library or existing workspace dependencies before adding new external crates.
- Keep
Cargo.lockchanges intentional; revert unrelated dependency bumps.
- Add
extern "C"function insrc/. - Add declaration to
include/lance.h. - Add C++ wrapper to
include/lance.hpp. - Add test in
tests/c_api_test.rs.