3 ms·
AFAIK, rust-bindgen doesn't currently have support for translating C functions and structs into anything other than the same things in Rust. It's somewhat idio
by comex 12y ago
AFAIK, rust-bindgen doesn't currently have support for translating C functions and structs into anything other than the same things in Rust. It's somewhat idiomatic for manually-written bindings, layered on top of the generated ones, to take care of things like providing a memory-safe interface (which can't really be done automatically), converting between native Rust types and C representations if necessary (perhaps including things like Result vs. error codes or nulls), and adding object orientation. If you want to go full automatic, though, you can do a lot with Rust macros, so give them a try.
Examples of manual wrappers on top of bindgen - there are many:
http://erickt.github.io/blog/2014/12/13/rust-and-mdbm/ http://erickt.github.io/blog/2014/12/13/rust-and-mdbm/
https://github.com/kenz-gelsoft/wxRust/blob/rust-servo/src/base.rs https://github.com/kenz-gelsoft/wxRust/blob/rust-servo/src/b... (I don't like the design of this one, actually)
https://github.com/rust-gnome/gtk/blob/master/src/widgets/action_bar.rs https://github.com/rust-gnome/gtk/blob/master/src/widgets/ac... (better)