2 releases
0.1.1 | Aug 31, 2021 |
---|---|
0.1.0 | Aug 22, 2021 |
#241 in #serde-json
43 downloads per month
Used in nacos-lib
4KB
55 lines
FormValue
Implement impl Form<CustomStruct> for serde_json::Value
Example
use from_value_derive::From;
#[derive(From, Debug, Clone, Deserialize, Serialize)]
pub struct Custom {
name: String,
}
From派生宏生成如下:
impl From<Custom> for Value{
fn from(params: Custom) -> Self {
let mut map = Map::new();
map.insert("name".to_string(), Value::from(params.name));
Value::Object(map)
}
Dependencies
~1.5–2MB
~49K SLoC