Closed filmor closed 2 months ago
Another option, instead of a derive
macro (or additional to one) would be to allow explicitly implementing a Resource
trait and registering it using a rustler::resource!()
outside of load
, which would use the inventory::submit!
under the hood. This would allow us to make the down
callback for #376 (and dyncall and other potential callbacks) a trait function with an empty default implementation.
If we like the derive
style, another alternative would be, to have a derive(Resource)
and a derive(MonitorResource)
, where MonitorResource
requires an implementation of a MonitorResource
trait with a down_callback
function and these would be different code paths with two sets of registrations. I think I'm in favour of that.
/edit: This is how it is implemented now: #[derive(MonitorResource)]
+ implementing the MonitorResource
trait.
Note to self: https://github.com/rusterlium/rustler/issues/84 is also a very interesting approach (completely doing away with the necessary pre-registration for resource types!), I'm just not quite sure how to incorporate monitors into it.
derive
macro (this one is removed again)This allows us to eventually deprecate the existing
resource!
macro and enables a path that fixes #606.