| Crates.io | asset-importer |
| lib.rs | asset-importer |
| version | 0.4.0 |
| created_at | 2025-09-17 15:10:28.508951+00 |
| updated_at | 2025-09-20 17:03:56.110422+00 |
| description | Comprehensive Rust bindings for the Assimp library |
| homepage | https://github.com/Latias94/asset-importer |
| repository | https://github.com/Latias94/asset-importer |
| max_upload_size | |
| id | 1843461 |
| size | 456,160 |
A comprehensive Rust binding for the latest Assimp 3D asset import library.
This crate provides safe, high-level Rust bindings for Assimp v6.0.2, implementing the vast majority of the C API with idiomatic Rust interfaces.
⚠️ Early Development: This library is functional but lacks extensive real-world testing. Use with caution in production environments.
Add to your Cargo.toml:
[dependencies]
# Default – Use prebuilt binaries (fastest)
asset-importer = "0.4"
# Or build from source (best compatibility)
asset-importer = { version = "0.4", features = ["build-assimp"] }
# Or use system-installed assimp
asset-importer = { version = "0.4", features = ["system"] }
Basic usage:
use asset_importer::Importer;
fn main() -> Result<(), Box<dyn std::error::Error>> {
let importer = Importer::new();
let scene = importer.import_file("model.obj")?;
println!("Loaded {} meshes", scene.num_meshes());
for mesh in scene.meshes() {
let vertices = mesh.vertices(); // Returns Vec<Vector3D>
println!("Mesh has {} vertices", vertices.len());
}
Ok(())
}
asset-importer = "0.4"
asset-importer = { version = "0.4", features = ["build-assimp"] }
asset-importer = { version = "0.4", features = ["system"] }
brew install assimp (macOS), apt install libassimp-dev (Ubuntu)asset-importer = {
version = "0.4",
features = [
"export", # Enable export functionality
"type-extensions", # Enable convenience methods on types
"mint", # Enable mint math library integration
"static-link", # Prefer static linking (source/prebuilt)
"nozlib" # Disable zlib compression support
]
}
When building from source (build-assimp feature), you'll need:
xcode-select --install)sudo apt install build-essential cmake on Ubuntu)For detailed platform-specific instructions and troubleshooting, see the asset-importer-sys README.
# .cargo/config.toml
[target.x86_64-pc-windows-msvc]
rustflags = ["-C", "target-feature=+crt-static"]
or per-build:
RUSTFLAGS="-C target-feature=+crt-static" cargo build --release
Prebuilt binaries: we publish both MD and MT variants on Windows. Filenames include a -md or -mt suffix, for example:
asset-importer-<version>-x86_64-pc-windows-msvc-<static|dylib>-md.tar.gz.
The build script auto-selects the variant matching your current CRT and falls back to old names if needed.
vcpkg (with features=["system"]):
x64-windows → /MD (dynamic)x64-windows-static → /MT (static)vcpkg install assimp:x64-windows or assimp:x64-windows-static.crt-static to avoid LNK2038.If you need more control or compatibility, use:
--features build-assimp to build from source (best compatibility)--features system to link an existing installationFor development work or when prebuilt binaries are not available:
# Use this for development
asset-importer = { version = "0.4", features = ["build-assimp"] }
This ensures you can always build from source regardless of release availability.
This crate provides a high-level safe API. For low-level FFI bindings, see asset-importer-sys.
This project aims to provide the most comprehensive and up-to-date Rust binding for Assimp, supporting both import and export functionality with modern Rust practices.
This workspace uses independent versioning for each crate:
asset-importer-sys: Tracks Assimp versions and FFI binding changesasset-importer: Tracks high-level API changes and featuresSee VERSIONING.md for detailed versioning strategy and release process.
Contributions welcome! Areas needing help:
If you're working with graphics and UI in Rust, you might also be interested in: