Lesson 49 of 50
rustCustom Derive Macros
12 minutes
Course progress98%
Custom Derive Macros
Create your own #[derive] macros to implement common functionality.
// In my_derive crate
#[proc_macro_derive(HelloWorld)]
pub fn hello_world_derive(input: TokenStream) -> TokenStream {
// parse input and generate impl of a trait
input
}