| Crates.io | struct2vec_derive |
| lib.rs | struct2vec_derive |
| version | 0.1.9 |
| created_at | 2021-08-21 15:40:07.658585+00 |
| updated_at | 2022-05-25 13:13:20.939248+00 |
| description | Rust structure to slice. |
| homepage | https://github.com/ptechen |
| repository | https://github.com/ptechen/ToVec.git |
| max_upload_size | |
| id | 440354 |
| size | 8,075 |
Rust structure to slice.
use struct2vec::ToVec;
use struct2vec_derive::ToVec;
use std::collections::HashMap;
#[derive(ToVec, Debug, Clone, Deserialize, Serialize)]
struct Custom {
#[to_vec(comment = "用户名", field_type = "字段类型")]
name: String,
}
let custom = Custom{name:String::from("123")};
custom.to_vec()
use struct2vec::ToVec;
use struct2vec_derive::ToVec;
use std::collections::HashMap;
use from_value_derive::From;
#[derive(ToVec, Debug, Clone, Deserialize, Serialize)]
struct Custom {
#[to_vec(comment = "用户名", field_type = "字段类型")]
name: String,
data: Data
}
#[derive(From, Debug, Clone, Deserialize, Serialize)]
struct Data {
key: String
}
let custom = Custom{name:String::from("123")};
custom.to_vec()