Currently the generator supports writing data models that are synced between rust and Qt. There is a wish for generating bindings for functions. A possible syntax could be this: "MyObject": { "type": "Object", "functions": { "removeDoneItems": { "arguments": [], "return": "void" }, "removeLargeItems": { "arguments": [{ "name": "thresholdSize", "type": "quint32" }], "return": "void" } } }
I've got most of the this solved. The only thing that's left as far as I can tell is the interface going back from rust String to a QString. I'll need to take a look at that when I get the time. I was able to make use of this in the qml_todo example I wrote. The only problem I'm having with that is that I can't find any way to batch together all of the removals. QT seems to require that you do a begin_removal before each set of consecutive removals. There doesn't seem to be a way to start a removal then remove items 1, 3, 5 or something like that.
Something else I was wondering. Is there a particular reason that we're requiring argument names? As far as I can tell there is never really a place that those are needed from a developer's perspective. The Rust-C interface doesn't care about argument names so we could just call it arg1, arg2, etc. as long as we get the types and order correct.
There is code to convert std::string::String to QString and back. This always requires a memory allocation because the encoding has to change between utf8 and utf16. "QT seems to require that you do a begin_removal before each set of consecutive removals." Yes, that is true. "Is there a particular reason that we're requiring argument names?" It is helpful when reading the code. Generated code will still show up in your IDE and arg1, arg2 etc are not nice there.