Getting Started

Installation

How to install RustO! across Rust, Node.js, Python, Go, Java, Flutter, .NET, React Native, iOS, Android, and Native C FFI.

RustO! is packaged modularly across multiple language package managers and registries. Choose your target environment below.

1. Rust (Cargo.toml)

Add rusto-rs via cargo:

cargo add rusto-rs

Or add it directly to your Cargo.toml:

[dependencies]
rusto-rs = "0.3.2"

Optional Cargo Features

FeatureDescription
ffiEnables C FFI and JNI bindings for embedding RustO! into foreign runtimes.
use-opencvEnables optional OpenCV backend for comparison testing and visual parity validation.
metalEnables Apple Metal GPU acceleration on macOS and iOS.
coremlEnables Apple CoreML neural engine backend on Apple Silicon.
vulkanEnables Vulkan compute shader acceleration for modern GPUs on Linux/Windows/Android.
openclEnables OpenCL acceleration on supported GPUs.
cudaEnables NVIDIA CUDA acceleration on Linux/Windows.
nnapiEnables Android Neural Networks API acceleration on compatible mobile chipsets.

2. Node.js (npm / yarn / pnpm)

Install @rustors/node via your preferred package manager:

npm install @rustors/node
# or yarn add @rustors/node
# or pnpm add @rustors/node

Pre-built native N-API binaries are automatically resolved for Linux (x64/arm64), macOS (Apple Silicon & Intel), and Windows (x64).


3. Python (pip / PyPI)

Install the pre-built wheel from PyPI:

pip install rusto

Supports Python 3.9+ across Linux, macOS, and Windows.


4. Golang (Cgo)

Fetch the Go package:

go get github.com/byrizki/rusto-rs/packages/go

Note: Building requires librusto shared library. Set CGO_LDFLAGS="-L/path/to/lib -Wl,-rpath,/path/to/lib" or place librusto.so / librusto.dylib in your system library path.


5. Java / JVM (JitPack / Gradle / Maven)

Add rusto-java from JitPack using Gradle:

repositories {
    mavenCentral()
    maven { url 'https://jitpack.io' }
}

dependencies {
    implementation 'com.github.byrizki.rusto-rs:rusto-java:0.3.2'
}

Or Maven:

<repositories>
    <repository>
        <id>jitpack.io</id>
        <url>https://jitpack.io</url>
    </repository>
</repositories>

<dependency>
    <groupId>com.github.byrizki.rusto-rs</groupId>
    <artifactId>rusto-java</artifactId>
    <version>0.3.2</version>
</dependency>

6. Flutter & Dart (pub.dev)

For Flutter Mobile & Desktop Apps

flutter pub add rusto_flutter

For Pure Dart / Server CLI

dart pub add rusto

7. .NET / C# (NuGet)

Install the core package from NuGet:

dotnet add package RustODotnet

Pre-Packaged Model Bundles

To include lightweight pre-packaged models without manually managing model assets on disk, add one of the official model packages:

# Recommended default PP-OCRv6 Tiny models (~6 MB total)
dotnet add package RustODotnet.Models.PPOCRv6.Tiny

# Or specialized language/tier model packages:
dotnet add package RustODotnet.Models.PPOCRv6.Small
dotnet add package RustODotnet.Models.PPOCRv5.Latin
dotnet add package RustODotnet.Models.PPOCRv4.Japanese

8. React Native (npm / yarn / pnpm)

Install the React Native npm package:

npm install @rustors/react-native

iOS Setup (ios/Podfile)

Add your preferred OCR model pod inside your app target in ios/Podfile:

target 'YourApp' do
  pod 'RustO-Models-PPOCRv6-Tiny' # ~6 MB (Recommended)
end

Then install the CocoaPods dependencies:

cd ios && pod install

Android Setup (android/app/build.gradle)

In your root settings.gradle, verify that JitPack is included:

dependencyResolutionManagement {
    repositories {
        google()
        mavenCentral()
        maven { url 'https://jitpack.io' }
    }
}

In android/app/build.gradle, add the model bundle:

dependencies {
    implementation 'com.github.byrizki.rusto-rs:rusto-models-ppocrv6-tiny:0.3.2'
}

9. iOS (Swift / CocoaPods & SPM)

Swift Package Manager (SPM)

In Xcode, select File > Add Package Dependencies... and enter:

https://github.com/byrizki/rusto-rs.git

Or in your Package.swift:

dependencies: [
    .package(url: "https://github.com/byrizki/rusto-rs.git", from: "0.3.2")
]

CocoaPods

In your project's Podfile:

target 'YourApp' do
  use_frameworks!

  pod 'RustO'
  pod 'RustO-Models-PPOCRv6-Tiny'
end

Run pod install.


10. Android (Kotlin / Gradle)

Ensure JitPack repository is registered in your root settings.gradle:

repositories {
    maven { url 'https://jitpack.io' }
}

Add the core library and model package in your app's build.gradle:

dependencies {
    implementation 'com.github.byrizki.rusto-rs:rusto-android:0.3.2'
    implementation 'com.github.byrizki.rusto-rs:rusto-models-ppocrv6-tiny:0.3.2'
}

11. Web & React (WASM)

# Core Web WASM library
npm install @rustors/web

# React Hooks & Components
npm install @rustors/react

12. C / Native Shared Libraries & Headers

Pre-compiled dynamic shared libraries and headers are published with every GitHub Release:

  • Linux: librusto.so (x86_64, aarch64)
  • macOS: librusto.dylib (Universal arm64 + x86_64)
  • Windows: rusto.dll, rusto.lib (x64, arm64)
  • C Header: rusto.h

To compile from source with FFI enabled:

cargo build --release --features ffi

The output dynamic and static libraries will be located in target/release/.