From a4c169bb9f519ce8f83e631a38c98678ec4ea10e Mon Sep 17 00:00:00 2001
From: librelois <elois@ifee.fr>
Date: Fri, 10 May 2019 23:20:29 +0200
Subject: [PATCH] [feat] common-tools: add trait merge

---
 lib/tools/common-tools/src/lib.rs          |  2 +-
 lib/tools/common-tools/src/traits/merge.rs | 22 ++++++++++++++++++++++
 lib/tools/common-tools/src/traits/mod.rs   | 18 ++++++++++++++++++
 3 files changed, 41 insertions(+), 1 deletion(-)
 create mode 100644 lib/tools/common-tools/src/traits/merge.rs
 create mode 100644 lib/tools/common-tools/src/traits/mod.rs

diff --git a/lib/tools/common-tools/src/lib.rs b/lib/tools/common-tools/src/lib.rs
index 56b827ac..17c4969b 100644
--- a/lib/tools/common-tools/src/lib.rs
+++ b/lib/tools/common-tools/src/lib.rs
@@ -28,4 +28,4 @@
 
 pub mod fns;
 pub mod macros;
-use std::io::Write;
+pub mod traits;
diff --git a/lib/tools/common-tools/src/traits/merge.rs b/lib/tools/common-tools/src/traits/merge.rs
new file mode 100644
index 00000000..31ac7537
--- /dev/null
+++ b/lib/tools/common-tools/src/traits/merge.rs
@@ -0,0 +1,22 @@
+//  Copyright (C) 2019  Éloïs SANCHEZ
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Affero General Public License as
+// published by the Free Software Foundation, either version 3 of the
+// License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU Affero General Public License for more details.
+//
+// You should have received a copy of the GNU Affero General Public License
+// along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+//! Trait Merge.
+
+/// Merge two instances of same type
+pub trait Merge {
+    /// Merge two instances of same type
+    fn merge(self, other: Self) -> Self;
+}
diff --git a/lib/tools/common-tools/src/traits/mod.rs b/lib/tools/common-tools/src/traits/mod.rs
new file mode 100644
index 00000000..f3f2049f
--- /dev/null
+++ b/lib/tools/common-tools/src/traits/mod.rs
@@ -0,0 +1,18 @@
+//  Copyright (C) 2019  Éloïs SANCHEZ
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Affero General Public License as
+// published by the Free Software Foundation, either version 3 of the
+// License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU Affero General Public License for more details.
+//
+// You should have received a copy of the GNU Affero General Public License
+// along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+//! Common rust traits for DURS project.
+
+pub mod merge;
-- 
GitLab