edgefirst_tflite_sys/lib.rs
1// SPDX-License-Identifier: Apache-2.0
2// Copyright (c) 2025 Au-Zone Technologies. All Rights Reserved.
3
4//! Low-level FFI bindings for the TensorFlow Lite C API.
5//!
6//! This crate provides raw, unsafe bindings generated by `bindgen` with
7//! `--dynamic-loading`. Symbols are resolved at runtime via `libloading`.
8//!
9//! **Most users should depend on `edgefirst-tflite` instead**, which
10//! provides a safe, ergonomic API on top of these bindings.
11//!
12//! # Library Discovery
13//!
14//! Use [`discovery::discover`] to automatically find and load the `TFLite`
15//! shared library, or [`discovery::load`] to load from a specific path.
16//!
17//! # Delegate Extensions
18//!
19//! The [`hal_ffi`] module provides function pointer structs for the
20//! HAL Delegate DMA-BUF API (the standard, delegate-agnostic interface).
21//!
22//! The [`vx_ffi`] module provides function pointer structs for the
23//! legacy `VxDelegate` DMA-BUF and `CameraAdaptor` APIs. Both are loaded
24//! at runtime from the delegate shared library.
25
26// Suppress all clippy/rustc/rustdoc warnings for bindgen-generated code.
27#[allow(
28 clippy::all,
29 clippy::pedantic,
30 clippy::nursery,
31 non_upper_case_globals,
32 non_camel_case_types,
33 non_snake_case,
34 missing_debug_implementations,
35 unreachable_pub,
36 dead_code,
37 rustdoc::bare_urls,
38 rustdoc::broken_intra_doc_links
39)]
40mod ffi {
41 include!("ffi.rs");
42}
43
44pub use ffi::*;
45
46/// Sentinel value for an unset `TfLiteBufferHandle` (`kTfLiteNullBufferHandle = -1`).
47#[allow(non_upper_case_globals)]
48pub const kTfLiteNullBufferHandle: TfLiteBufferHandle = -1;
49
50pub mod discovery;
51pub mod hal_ffi;
52pub mod vx_ffi;