reqrio-json 0.1.12

reqrio json lib
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use serde::{Deserialize, Serialize};
use crate::{JsonResult, JsonValue};

pub trait JsonExt
where
    Self: Serialize + for<'a> Deserialize<'a>,
{
    fn new() -> Self;
}

impl JsonValue {
    pub fn to_struct<T: JsonExt>(self) -> JsonResult<T> {
        let mut self_struct = crate::from_struct(&T::new())?;
        self_struct.update_by(self)?;
        self_struct.as_struct()
    }
}