该技能用于说明 xberg 项目 crates/xberg/Cargo.toml 中的 Cargo feature flag 策略,核心是把依赖 ONNX Runtime(ORT)的路径与纯 Rust 路径分开,以便在不支持原生 ORT 的目标上运行。
用途与主要能力:识别 ORT 不兼容的目标(WASM、x86_64-linux-android 模拟器),并提供替代实现。仅 ORT 相关路径不兼容:paddle-ocr、layout-detection、embeddings、auto-rotate 均依赖 ORT,无 WASM 支持,也无 Android x86_64 预构建。纯 Rust 类型伴随特性可在不引入 ORT 的情况下暴露公共配置与结果类型,例如 layout-types(layout-detection 隐含它)、auto-rotate-types(auto-rotate 隐含它)、embedding-presets。纯 Rust 的 tract 推理变体可在无法链接原生 ORT 处运行部分 ONNX 模型:layout-detection 对应 layout-tract,auto-rotate 对应 auto-rotate-tract,二者均可在 WASM 与 Android x86_64 模拟器上运行;TATR、SLANeXT、PP-DocLayout-V3、YOLO 仍仅限 ONNX Runtime。
WASM/Android 安全变体:ocr 对应 ocr-wasm,excel 对应 excel-wasm,tree-sitter 对应 tree-sitter-wasm;tree-sitter-wasm 不在 wasm-target 中,因为 306 语言语法包超过 jsDelivr 单文件 50 MB 上限。liter-llm、stopwords、keywords 属于 no-ort-target。聚合特性包括 formats、full、no-ort-target、wasm-target、android-target。PDF 后端使用 pdf 特性,基于纯 Rust 的 pdf_oxide,是默认提取管线,无单独的 pdf-oxide 特性。ORT 变体 ort-bundled 与 ort-dynamic 互斥。部分依赖按平台条件选择,FFI 与 Dart 依赖在 Android、iOS、Windows、macOS x86_64 上选择不同目标特性。
限制:具体启用的命令、构建步骤与版本细节资料未完整提供;特性兼容性以项目文档为准。