10 releases
Uses new Rust 2024
| new 0.1.9 | Apr 7, 2026 |
|---|---|
| 0.1.8 | Mar 17, 2026 |
| 0.1.6 | Feb 10, 2026 |
| 0.1.4 | Jan 31, 2026 |
#97 in macOS and iOS APIs
1MB
21K
SLoC
mtl-rs
Rust bindings for Apple's Metal API, built on the modern objc2 ecosystem.
Features
- Comprehensive Metal API coverage
- MTL4 (Metal 4) API bindings
- Built on
objc2for safe and modern Objective-C interop - Supports macOS and iOS
Installation
Add to your Cargo.toml:
[dependencies]
mtl-rs = "0.1.7"
Usage
use metal::MTLDevice;
fn main() {
let device = <dyn MTLDevice>::system_default()
.expect("No Metal device found");
println!("Device: {:?}", device.name());
println!("Unified memory: {}", device.has_unified_memory());
println!("Max threadgroup size: {:?}", device.max_threads_per_threadgroup());
}
Examples
Run with cargo run --example <name>:
drawing_a_triangle_with_metal_4— Render a rotating triangle using Metal
Platform requirements
- macOS with a Metal-capable GPU
- Xcode command line tools installed
- Rust toolchain with Apple targets
License
MIT
Dependencies
~6MB
~110K SLoC