janus-plugin-rs icon indicating copy to clipboard operation
janus-plugin-rs copied to clipboard

Higher-level and more safe API

Open 0nkery opened this issue 6 years ago • 2 comments

Hi!

Thanks for helpful library!

Are there any plans to implement more higher-level and safe API? I have kind of proposal but there are many details it lacks.

  1. Plugin trait which defines all the callbacks user should implement in two ways: low-level (raw) and high-level. The latter operates on more idiomatic Rust entities such as references, Rust structs, strings and numeric values while the former leaves all the raw details in place allowing to skip possibly slow conversions and defaults to calling 'high-level' methods.
  2. One more macros which defines extern "C" functions along with static declaration of user object which implements Plugin trait. Functions just deal with acquisition of static object and call methods on it.
  3. init callback can be more elaborate - it can initialize callbacks to Janus Core which crate then will use to provide more high-level API for them (just regular public functions, no need to fetch global PluginCallbacks object and call functions there).

It's unclear to me how to wrap all Janus objects from outside in more convenient and safe way.

What do you think of this?

0nkery avatar Nov 19 '18 07:11 0nkery