Closed
Description
Context:
- rustdoc: Add
ItemTemplate
trait and related functions to avoid repetitively wrapping existing functions #111946 (see section: existing discussion on how to solve this issue) - Removing only
.borrow()
calls will raise compilation errors - Initial idea of creating derive macros for
ItemTemplate
Would like to hear more ideas to tackle this problem, but this is my proposal (rough idea):
- Blanket impl of
ItemTemplate
for references:impl<T: ItemTemplate> ItemTemplate for &T
-
derive
macro forItemTemplate
; One might ask, is there a need for macros here?impl<T: ItemTemplate> askama::Template for &T
is required- Can't apply blanket impl because it involves an external trait
- So, we are left with implementing this trait for each
&T
, which can be done by copying the associated types and calling existing methods fromT
(basically making&T
behave the same asT
)
I suspect that we can gain more by creating macros here, but it is still under exploration.