#stable-diffusion #flux #ai

sys diffusion-rs-sys

Rust bindings for stable-diffusion.cpp (FFI bindings)

19 releases

Uses new Rust 2024

0.1.18 Jan 26, 2026
0.1.14 Dec 28, 2025
0.1.12 Sep 9, 2025
0.1.11 Jul 17, 2025
0.1.3 Nov 14, 2024

#1817 in Machine learning


Used in diffusion-rs

MIT license

15MB
187K SLoC

C++ 95K SLoC // 0.1% comments C 37K SLoC // 0.0% comments CUDA 16K SLoC // 0.0% comments GLSL 14K SLoC // 0.0% comments OpenCL 10K SLoC Metal Shading Language 7.5K SLoC // 0.1% comments WebGPU Shader Language 4.5K SLoC // 0.0% comments Objective-C 1.5K SLoC // 0.1% comments Templ 1K SLoC // 0.0% comments Rust 213 SLoC // 0.0% comments Python 175 SLoC // 0.2% comments

diffusion-rs

Latest version Documentation

Rust bindings to https://github.com/leejet/stable-diffusion.cpp

Features Matrix

Windows Mac Linux
vulkan ✅️ ✅️ ✅️
metal - ✅️ -
cuda ✅️ - ✅️
rocm - ⛓️‍💥
sycl - ✅️

✅️: Working

❔: Not tested

❌: See this cargo issue

⛓️‍💥 : Issues when linking libraries

Usage

use diffusion_rs::{api::gen_img, preset::{Preset,PresetBuilder}};
let (config, mut model_config) = PresetBuilder::default()
            .preset(Preset::SDXLTurbo1_0)
            .prompt("a lovely duck drinking water from a bottle")
            .build()
            .unwrap();
gen_img(&config, &mut model_config).unwrap();

Troubleshooting

  • Something other than Windows/Linux isn't working!
    • I don't have a way to test these platforms, so I can't really help you.
    • If you can fix the issue, please open a PR!

Dependencies