| Crates.io | derive2 |
| lib.rs | derive2 |
| version | 0.1.0 |
| created_at | 2025-02-12 12:54:16.331616+00 |
| updated_at | 2025-02-12 12:54:16.331616+00 |
| description | An attribute macro that executes a function-like macro |
| homepage | |
| repository | https://github.com/mysteriouslyseeing/derive2/ |
| max_upload_size | |
| id | 1552971 |
| size | 13,717 |
Provides #[derive2(...)], an alternative to #[derive(...)] that allows the use of macro_rules macros.
derive2 takes all its arguments, and calls them like function macros with the item it is applied to:
#[derive2(macro0, macro1)]
#[derive(Default)]
pub enum Foo {
#[default]
Bar,
#[macro0(something)]
Baz,
}
expands to
#[derive(Default)]
pub enum Foo {
#[default]
Bar,
Baz,
}
macro0! {
#[derive(Default)]
pub enum Foo {
#[default]
Bar,
#[macro0(something)]
Baz,
}
}
macro1! {
#[derive(Default)]
pub enum Foo {
#[default]
Bar,
#[macro0(something)]
Baz,
}
}