Call external user code during runtime

I have an application that takes care of it's lifecycle (rendering, calls to server, etc) but I want the user to be able to add it's own code to customize how this application behaves or renders for some situations.

Coming from C#, this could be resolved using reflection, where my app tries to look for a class or method with a given attribute / name and tried to execute it, if there is none it would keep working as normal, otherwise it would execute the external user code.

So far I have not found a similar solution in Rust for the same problem. Probably this could be solved using another architecture / design that I'm not yet familiar as I'm still getting used to the language, but someone with more expertise could provide more knowledge on how to solve this?

You are going to want to look for either dynamic loading of plugins or embedding a scripting language into your application.

Dynamic Loading is what I have been looking for, thanks!

1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.