Skip to main content

Crate el_ffi

Crate el_ffi 

Source
Expand description

el-ffi — host bindings for the Rust core (ADR-001, ADR-009, ADR-010).

One Rust API surface exported three ways:

§React Native — uniffi-bindgen-react-native (ADR-001)

#[derive(uniffi::Object)] + #[uniffi::export] → TypeScript + JSI C++ + Turbo Module. Streaming via StreamHandler callback interface (UniFFI cannot export impl FnMut parameters).

§Dart / pub.dev — flutter_rust_bridge v2 codegen (ADR-024)

#[frb(opaque)] on EdgeLlm → Dart opaque handle. ask()Future<String>, edge_llm_ask_stream() + StreamSink<String>Stream<String>.

§Web / npm — wasm-bindgen (ADR-001)

#[wasm_bindgen] on both the struct and the impl block → ESM TypeScript package via wasm-pack. The struct annotation is required: without it wasm-bindgen cannot satisfy IntoWasmAbi/WasmDescribe for the impl block.

Web limitations: the local path uses a dev-stage echo placeholder until Candle-on-wasm is wired, and the cloud backend is not available on web (ADR-010 amendment): el-cloud’s blocking HTTP transport has no wasm implementation, so EdgeLlm.cloud throws an explicit error there instead of silently degrading.

Modules§

dart_api
Dart / FRB wrappers.

Structs§

EdgeLlm
The flat FFI-friendly facade (ADR-001, ADR-009, ADR-010).
UniFfiTraitVtableStreamHandler

Enums§

SdkError
Error returned across the FFI boundary.

Traits§

StreamHandler
Token-by-token callback for streaming on React Native.

Functions§

uniffi_el_ffi_fn_init_callback_vtable_streamhandler