-
-
Notifications
You must be signed in to change notification settings - Fork 73
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using mun to script rust? #288
Comments
Hey @shadowcat-mst ! The goal would be to enable interoping between the two language in roughly the same way you describe but we are not there yet. You can bind rust functions that you can then use in Mun and you can call Mun functions from rust. We dont have any form of traits or associated methods currently. The docs here show how to call Rust functions from Mun: https://docs.mun-lang.org/ch02-04-extern-fn.html . It's currently still limited to primitive types (f32, i32, u64, etc). So, you'll have to hang in there a little longer. Well get there! :) Hope that answers your question? |
Aha, I see. I somehow read that document, saw the 'extern C' one, and then completely flipping missed the first non-C-ABI example. Whereabouts in the codebase would I look to see the current bits? I'm not at the point with the project that led me to start asking questions where it's an itch I'm likely to try to scratch myself, I'm afraid, but I'd love to at least read up and understand what's there a bit better :) |
I can see in the documentation that I can bind in an extern C function, which I presume also means I can bind in a plain rust function.
However I'm not sure where I'd start to, say, expose a rust struct and its methods to mun code, and I'm also not sure where to look to try and figure out where to start :/
To be clear, my hope would be to be able to do roughly
where get_thing_from_rust returns a struct or a reference thereto and futz_thing can then call 'thing.futz()' on the rust side or similar.
I apologise if this issue is still vague or if I've missed something obvious - replies of the form "please go read document X" or "please go read code Y" or "please clarify question Z" would be much appreciated :D
The text was updated successfully, but these errors were encountered: