docs.rs failed to build rusto-mnn-0.2.0
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
MNN Rust Bindings
Safe Rust bindings for the MNN (Mobile Neural Network) inference library.
Overview
This crate provides a high-level, safe Rust interface to MNN, built on top of mnn-sys which provides the low-level FFI bindings.
Features
- Safe API: All unsafe operations are wrapped in safe Rust abstractions
- Zero-copy operations: Efficient tensor data transfer
- Platform support: CPU, Metal (macOS/iOS), CoreML, OpenCL, CUDA, and more
- Configurable backends: Choose the best backend for your platform
Usage
use ;
use Path;
// Load model
let interpreter = from_file?;
// Configure session
let mut config = new;
config.set_type;
let mut backend_config = new;
backend_config.set_precision_mode;
backend_config.set_power_mode;
config.set_backend_config;
// Create session
let mut session = interpreter.create_session?;
// Get input tensor
let mut input_tensor = interpreter.input?;
// ... prepare input data ...
// Run inference
interpreter.run_session?;
// Get output
let output_tensor = interpreter.output?;
Platform-Specific Features
macOS/iOS
Enable Metal and CoreML backends:
[]
= { = "crates/mnn", = ["metal", "coreml"] }
Linux/Android
OpenCL backend is enabled by default on these platforms.
Building
This crate requires:
- CMake 3.10+
- C++11 compiler
- Platform-specific SDK (e.g., Metal SDK for macOS)
The MNN library is compiled from source during the build process.