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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
//! It can be converted to another type with the same name field.
//!
//! # Usage
//! ```
//! use type_change::From;
//!
//! #[derive(Clone)]
//! struct Foo {
//! id: i64,
//! name: String,
//! }
//!
//! #[derive(From)]
//! #[from(Foo)]
//! struct Bar {
//! id: i64,
//! name: String,
//! }
//!
//! // equal to follows
//! //
//! // impl From<Foo> for Bar {
//! // fn from(foo: Foo) -> Bar {
//! // Bar { id: foo.id, name: foo.name }
//! // }
//! // }
//! //
//!
//! let foo = Foo { id: 1, name: "foo".to_string() };
//! let bar = Bar { name: "bar".to_string(), ..foo.clone().into() };
//! assert_eq!(foo.id, bar.id);
//!
//! ```
//!
//! # Notes
//! - Only struct with the same field name can be converted.
//! - All field names must match and be accessible.
//!
//! # Contributing
//! **Thanks!**
//!
use TokenStream;
use ;