2 stable releases
1.0.1 | Apr 21, 2024 |
---|
#664 in Procedural macros
5KB
71 lines
This macro was very useful to me when using actix, instead of making a bunch of structs for each possible json, you can use this macro and simply define the struct with a macro above the functions. To use this macro you can do the following:
use in_struct::define_struct;
#[define_struct(name = Name, derives = [Debug], fields = {field_1: i32, field_2: String})]
fn func(x: Name) {
println!("{:?}", x);
}
lib.rs
:
This macro was very useful to me when using actix, instead of making a bunch of structs for each possible json, you can use this macro and simply define the struct with a macro above the functions. To use this macro you can do the following:
use in_struct::define_struct;
#[define_struct(name = Name, derives = [Debug], fields = {field_1: i32, field_2: String})]
fn func(x: Name) {
println!("{:?}", x);
}
Dependencies
~225–670KB
~16K SLoC