2 ms·
> Right now the only language-level thing I would like is const operator overloading. As far as I know, const traits are still on track. > easier passing of c
by JoshTriplett 2y ago
> Right now the only language-level thing I would like is const operator overloading.
As far as I know, const traits are still on track.
> easier passing of closures from Rust to C
As in, turning a Rust closure into a C function-pointer-plus-context-parameter?
> The "data structure interoperability" part of the roadmap is something I should present to someone in the Rust community for impressions. Some kind of standardization of core FFI traits would be nice.
Would be happy to work with you to get something on the calendar.
- bonzini 2y ago> As far as I know, const traits are still on track. Yes they are. My use case is something like the bitflags crate, there are lots of bit flags in emulated devices of course. In the meanwhile I guess it would be possible to use macros to turn something like "bit_const!(Type:A|B)" to "Type(A.0|B.0)" or something like that. > As in, turning a Rust closure into a C function-pointer-plus-context-parameter? Yes, more in general everything related to callbacks is doable but very verbose. We might do (procedural?) macro magic later on to avoid the verbosity but for now I prefer to stick to pure Rust until there's an idea of which patterns recur. Let me know by email about any occasions to present what I have.
- 0x457 2y agoI made this handy function to pass callbacks to C: https://github.com/andoriyu/uclicious/blob/master/src/traits.rs#L38-L62 https://github.com/andoriyu/uclicious/blob/master/src/traits...