inter_struct/lib.rs
1//! Inter-struct provides various derive macros to implement traits between arbitrary structs.
2//!
3//! The current available `derive` macros are:
4//!
5//! - `StructMerge`
6//! - `StructMergeRef`
7//! - `StructInto`
8//! - `StructDefault`
9//!
10//! The general way to use such a derive macro is like this:
11//!
12//! ```rs,ignore
13//! #[derive(StructInto)]
14//! #[struct_into(["crate::path_to::TargetStruct"])]
15//! pub struct Test {
16//! pub test: String,
17//! }
18//! ```
19//!
20//! This example generates an `impl Into<TargetStruct> for Test`, which converts `Test`
21//! into some `TargetStruct`.
22//!
23//! Note that the target struct's paths has to be
24//! - contained in this crate.
25//! - relative to the current crate.
26//!
27//! Either a single path or a list of paths can be specified.
28//! The traits will then be implemented for each given target struct.
29//!
30//! ```rs,ignore
31//! #[struct_into("crate::path_to::TargetStruct")]
32//! // or
33//! #[struct_into(["crate::path_to::TargetStruct", "crate::path_to::AnotherTargetStruct"])]
34//! ```
35//!
36//! Each derive macro can have their own options, so please check the individual docs for each
37//! derive macro in this crate.
38
39pub use inter_struct_codegen::*;
40
41/// Docs and traits for struct merging.
42pub mod merge;
43
44/// Imports all modules to get you started.
45pub mod prelude {
46 pub use super::merge::*;
47 pub use inter_struct_codegen::*;
48}