1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
use struct_convert::Convert;
#[derive(Convert)]
#[convert(from = "some_mod::Remote")]
#[convert(from = "C")]
#[convert(into = "B")]
struct A {
value: i64,
}
struct B {
value: i64,
}
struct C {
value: i64,
}
mod some_mod {
pub struct Remote {
pub value: i64,
}
}
fn main() {}
#[test]
fn test_proxy() {
let c = C { value: 8 };
let a: A = c.into();
let b: B = a.into();
debug_assert_eq!(8, b.value);
let r = some_mod::Remote { value: 7 };
let a2: A = r.into();
debug_assert_eq!(7, a2.value);
}