Added register_local_helper_rc to RenderContext.#383
Added register_local_helper_rc to RenderContext.#383ExPixel wants to merge 3 commits intosunng87:masterfrom
register_local_helper_rc to RenderContext.#383Conversation
|
Thank you for your patch! Instead of creating a new method for this, I'm +1 for your idea of using generics. I'm working on 4.0 so even a little break change is acceptable at the moment. |
Also implemented `HelperDef` directly on Rc's and Arc's so that they can be passed directly into `register_local_helper`. With this change we can call `register_local_helper(helper)` instead of `register_local_helper(Box::new(helper))`.
|
So I went ahead and just made it generic in a bit of a different way. This should still allow |
|
This looks great to me! Please go ahead. |
|
Alright, so upon further inspection (and after more sleep) this doesn't really do what I set out for it to. The |
7abfce6 to
4962d7e
Compare
Since
register_local_helperandget_local_helperalready make use ofRcin their signatures I figured there wouldn't be any harm in providing a way to create helpers usingRcdirectly without the reallocation required byRc::from_box. It also allows using the same helper definition for multiple helpers with different names.I also thought about
fn register_local_helper<T: Into<Rc<dyn HelperDef + 'rc>>>but I think that might mess with type inference.