An attribute-like macro to implement traits for Either
(defined in either
crate). If your trait is implemented for both type A
and B
, then it is automatically implemented for Either<A, B>
.
When defining a trait, add the attribute #[either_trait]
.
```rust use either::Either; use eithertraitmacro::either_trait;
/// Apply a function n
times.
trait Apply {
fn times
struct Once;
impl Apply for Once {
fn times
impl Apply for u32 {
fn times
let either: Either
This macro only supports traits without any associated constant or associated type. The first parameter of a trait method must be self
, &self
or &mut self
. The types of other parameters and the return type must not contain Self
.