2个稳定版本
1.0.1 | 2024年4月21日 |
---|
390 在 进程宏
每月29次下载
5KB
71 行
当使用actix时,这个宏对我来说非常有用,您不必为每个可能的JSON创建大量结构,您可以使用这个宏并在函数上方简单定义结构。要使用此宏,您可以执行以下操作
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
:
当使用actix时,这个宏对我来说非常有用,您不必为每个可能的JSON创建大量结构,您可以使用这个宏并在函数上方简单定义结构。要使用此宏,您可以执行以下操作
use in_struct::define_struct;
#[define_struct(name = Name, derives = [Debug], fields = {field_1: i32, field_2: String})]
fn func(x: Name) {
println!("{:?}", x);
}
依赖项
~245–680KB
~16K SLoC