doku
doku copied to clipboard
Generic types
Our current derive macro doesn't understand generic types, e.g.:
struct Response<T> {
body: T,
pagination: Pagination,
}
... forcing users to implement the Document trait by hand:
impl<T: Document> Document for Response<T> {
/* ... */
}
Adding support for generic types will boil down to making #[derive(Doku)] understand generics and adding automatic : Document bound for all of the type parameters (with an opt-out switch):
struct Wrapper<'a, B: Foo, C, const D: usize>
where
B: Bar
{
/* ... */
}
// should generate, more or less:
impl<'a, B: Foo, C, const D: usize> Wrapper<'a, B, C, D>
where
B: Bar + Document
C: Document
{
/* ... */
}