Question : rust create derive trait
Answered by : talented-tapir-w9w3z99z6qka
#[macro_use]
extern crate hello_world_derive;
trait HelloWorld { fn hello_world();
}
#[derive(HelloWorld)]
struct FrenchToast;
#[derive(HelloWorld)]
struct Waffles;
fn main() { FrenchToast::hello_world(); Waffles::hello_world();
}
Source : https://web.mit.edu/rust-lang_v1.25/arch/amd64_ubuntu1404/share/doc/rust/html/book/first-edition/procedural-macros.html | Last Update : Mon, 18 Apr 22