Skip to main content

config/
merge.rs

1use crate::{Configuration, Settings};
2
3/// Defines the behavior of a merge operation between two objects.
4pub trait Merge<T = Self> {
5    /// Merges an object into current object.
6    ///
7    /// # Arguments
8    ///
9    /// * `other` - The other object to merge into the current object
10    fn merge(&mut self, other: &T);
11}
12
13impl Merge<Configuration> for Settings {
14    #[inline]
15    fn merge(&mut self, other: &Configuration) {
16        self.merge(&other.settings)
17    }
18}
19
20impl Merge for Configuration {
21    #[inline]
22    fn merge(&mut self, other: &Self) {
23        self.settings.merge(&other.settings)
24    }
25}
26
27impl Merge<Settings> for Configuration {
28    #[inline]
29    fn merge(&mut self, other: &Settings) {
30        self.settings.merge(other)
31    }
32}