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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
use ;
/// A trait that defines a method for merging an instance of T into an instance of Self.
/// A trait that defines a method for merging an instance of Self into an instance of T.
/// When a type implements `MergeFrom` for another type, automatically implement `MergeInto` for the other type.
/// A trait that defines a method for merging an instance of T into an instance of Self, with the possibility of an error occurring.
/// The `Error` type is used to indicate the error that may occur during the merge operation.
/// A trait that defines a method for merging an instance of Self into an instance of T, with the possibility of an error occurring.
/// The `Error` type is used to indicate the error that may occur during the merge operation.
/// When a type implements `TryMergeFrom` for another type, automatically implement `TryMergeInto` for the other type.
/// When a type implements `MergeFrom` for another type, automatically implement `TryMergeFrom` on the same type for the other type.
/// Merges two instances of type `Config` and `PartialConfig` into a single instance of `Config`.
///
/// By using this function instead of calling `merge_from` directly, you can help the Rust compiler to better infer your config types.
/// This is because this function requires `Config` to implement `MergeFrom<PartialConfig>`.
///
/// The `PartialConfig` instance is merged into the `Config` instance.
///
/// `Config` must implement the `MergeFrom` trait for `PartialConfig`.
///
/// `Config` and `PartialConfig` must both implement the `Serialize` and `Deserialize` traits from `serde`.
///
/// # Parameters
///
/// * `config` - The instance of `Config` to merge `partial_config` into.
/// * `partial_config` - The instance of `PartialConfig` to be merged into `config`.
///
/// # Returns
///
/// An instance of `Config`, which is the result of the merge operation.
/// Tries to merge two instances of type `Config` and `PartialConfig` into a single instance of `Config`.
///
/// By using this function instead of calling `try_merge_from` directly, you can help the Rust compiler to better infer your config types.
/// This is because this function requires `Config` to implement `TryMergeFrom<PartialConfig>`.
///
/// The `PartialConfig` instance is merged into the `Config` instance.
///
/// `Config` must implement the `TryMergeFrom` trait for `PartialConfig`.
///
/// `Config` and `PartialConfig` must both implement the `Serialize` and `Deserialize` traits from `serde`.
///
/// # Parameters
///
/// * `config` - The instance of `Config` to merge `partial_config` into.
/// * `partial_config` - The instance of `PartialConfig` to be merged into `config`.
///
/// # Returns
///
/// A `Result` indicating success or failure.
/// * Success is indicated by an `Ok` value, containing an instance of `Config`, which is the result of the merge operation.
/// * Failure is indicated by an `Err` value, containing an instance of the error type.