Closed arrtchiu closed 5 years ago
For some reason, I can return Vec
s from methods but not accept them as params. References > and arrays also have the same issue.
All type conversation rules is described via Domain specific language, that looks like Rust macroses.
Corresponding rule related to your problem you can find here:
As you see to "trigger" this rule your type should implement Clone
,
rust_swig
doesn't parse your real Rust code, so you should point rust_swig about Clone implementation via:
foreign_class!(
#[derive(Clone)]
class Foo {
Sorry for all the questions you'd like me to contribute financially!
I am more interesting in code contribution and testing. So contribution via questions is not bad, because of it real usage in other words testing. May be someday I improve error handling to report rules that may be matched, but were skipped because of trait bounds mismatch.
Thanks! Adding that derive inside the foreign_class!
did the trick.
Is something bad possible if I mismatch them?
Is something bad possible if I mismatch them?
No, rust_swig generates normal Rust code, so you got compilation error about missed function or type mismatch in generated code if something goes wrong.
Sorry for all the questions, I really appreciate your help - let's discuss if you'd like me to contribute financially!
For some reason, I can return
Vec<Foo>
s from methods but not accept them as params. References and arrays also have the same issue.I basically copied the code from the tests: