Expand description
§autogen
Tired of repeating all the generics in every impl
block or function?
Autogen is a set of macros that allows you to automatically apply generics to impl
blocks and
functions.
- the register macro registers the generics of a
struct
orenum
, including lifetimes and the where clause. - the apply macro applies the generics to an
impl
block or function.
#[autogen::register]
struct Struct<'a, T, R: ?Sized>
where
T: PartialEq,
{
x: T,
y: &'a R,
}
#[autogen::apply]
impl Struct {}
This will expand to:
impl<'a, T, R: ?Sized> Struct<'a, T, R> where T: PartialEq {}