Crate apply_macro[][src]

Expand description

An attribute macro to apply function-like macros. It can improve the readability of your code.

This crate has no dependency so you don’t need to worry about compile time.

Example

macro_rules! common_derive {
    ($input:item) => {
        #[derive(Debug, PartialEq)]
        $input
    };
}

#[apply(common_derive)]
struct Num(i32);

assert_eq!(Num(-1), Num(-1));
assert_ne!(Num(1), Num(-1));

The #[apply(common_derive)] above expands to:

common_derive! {
    struct Num(i32);
}

Attribute Macros

apply

The main attribute macro of this crate.