How to deal with Rust libraries for bindings?

I’m trying to generate binding for the physics library “Rapier”. For reference, I was studying the “wgpu” vendor library. There i found some deviation from the original library, like this:


There are many like this. Like is it intentional? if yes, why?

More over how to deal with rust libraries in general for algebraic enums which hold some values, which struct to redefine and which structs are to be defined to be raw pointers?

They might be bindings of different versions of WebGPU.

The wgpu vendor package binds to GitHub - gfx-rs/wgpu-native: Native WebGPU implementation based on wgpu-core

1 Like

More over how to deal with rust libraries in general for algebraic enums which hold some values, which struct to redefine and which structs are to be defined to be raw pointers?

Any help for this?

Write a C interface using pub extern "C" and #[repr(C)] and bind to that.