mapstruct/
lib.rs

1pub use mapstruct_derive::MapStruct;
2
3#[cfg(test)]
4mod test {
5    use super::*;
6
7    #[derive(MapStruct)]
8    #[mapstruct(
9        #[derive(Debug)]
10        struct Y<
11            +'a,
12        > {
13            ~id -> pub id,
14            ~name: &'a str,
15            ~some: &'a str,
16            +last_name: &'a str,
17            -height,
18        }
19    )]
20    struct X {
21        id: i64,
22        name: String,
23        age: i32,
24        height: f32,
25        some: String,
26    }
27
28    impl<'a> Into<Y<'a>> for &'a X {
29        fn into(self) -> Y<'a> {
30            Y {
31                id: self.id,
32                name: &*self.name,
33                age: self.age,
34                some: &*self.some,
35                last_name: &*self.name,
36            }
37        }
38    }
39
40    #[test]
41    fn test() {
42        println!("Hello, world!")
43    }
44}