Rust API
Safe Rust API for the ClikaRT on-device inference runtime, over the versioned C core ABI.
Api::load opens the runtime shared library at run time and performs the
two-arm handshake, the cross-language load-time invariant: the abi
version first (clika_rt_get_api answers NULL for a version the runtime
cannot serve), then the api-table layout fingerprint (the served table's
fingerprint must equal the C header this crate compiled against and
LAYOUT_FINGERPRINT, the value the generated surface was emitted
from). Either refusal is a readable error before the first call. Runtime
failures map to Error carrying the machine-readable code_name
(which survives release obfuscation; branch on it, never on the message
text).
The surface, by layer:
generated: one wrapper per api-table member: thef_<member>Resultprimaries, their panicking twins, theTensoroperator methods, and the<Op>Optionsstructs (re-exported at the root).ops:+,-,*,/, unary-over tensors and scalars.index: subscripting:x.i((.., 0, 1..3)).nn:Module,Linear,Sequential, andVarBuilderdotted-key weight loading.data: typed slice entry (Element, theF16/BF16bit carriers).onnx: builders for the graph-authoring dimension / attribute values.
This crate is the ONLY consumer of clika-rt-sys (the raw,
bindgen-generated FFI, re-exported as sys for constants such as the
dtype values); dependent crates use this crate and never the raw FFI.
| Name | Kind |
|---|---|
Api | struct |
Error | struct |
Tensor | struct |
data | module |
generated | module |
index | module |
nn | module |
onnx | module |
ops | module |