- update documentation
- update documentation
- move format
#[trait_gen(T in [u64, i64, u32, i32])]
into feature - add 'deprecated' warnings when using this 'in' format
- add alternative format
#[trait_gen(T in [u64, i64, u32, i32])]
- simplify marcro argument processing
- add general type substitution:
#[trait_gen(my::T -> &i32, &mut i32, Box<i32>)] impl MyLog for my::T { fn my_log2(self) -> u32 { MyLog::my_log2(*self) } }
- allow substitution in inner
trait_gen
attributes, so that their order doesn't matter:#[trait_gen(U -> u8, u16, u32, u64, u128)] #[trait_gen(T -> &U, &mut U, Box<U>)] impl MyLog for T { fn my_log2(self) -> u32 { MyLog::my_log2(*self) } }
- fix bug in multisegment path substitution
- add multi-segment paths in parameters:
#[trait_gen(inner::U -> super::Meter<f32>, super::Foot<f32>)] impl Add for inner::U { type Output = inner::U; fn add(self, rhs: Self) -> Self::Output { inner::U(self.0 + rhs.0) } }
- fix
U::MAX
not replaced with#[trait_gen(U -> ...)]
and other bugs
- add simple type arguments substitution, which can be used in cross-product generation:
#[trait_gen(T -> Meter, Foot)] #[trait_gen(U -> f32, f64)] impl GetLength<U> for T<U> { fn length(&self) -> U { self.0 as U } }
- add real type substitution in docs, expression string literals and macros (
${T}
):#[trait_gen(T -> u32, u64)] impl Lit for T { /// Produces a string representation for ${T} fn text(&self) -> String { call("${T}"); format!("${T}: {}", self) } }
- add constructor substitution with the
T ->
form - all paths starting with the type parameter are replaced, for example
T::default()
hasT
replaced with theT ->
form (before, the whole path had to match)
- add improved attribute format
#[trait_gen(T -> u64, i64, u32, i32)]
- simplify documentation
- fix documentation URL & few typos
First version
- trait_gen::trait_gen proc macro